Skip to main content

Plugin to implement ollama (LLMs) based translations for ocr_translate

Project description

Plugin ocr_translate_ollama

This is a plugin for ocr_translate that implements translations through ollama using Large Language Models (LLM)s.

Usage

  • Install this by running pip install ocr_translate_ollama
  • Add ocr_translate_ollama to your INSTALLED_APPS in settings.py
  • Run the server with AUTOCREATE_VALIDATED_MODELS once

Ollama name prefixes

To avoid cluttering the ollama server (or having to set a dedicated one), the plugin will create new models from the original one (with a dedicated system prompt) adding the prefix oct_ollama_ to the model names.

This behavior can be changed by setting the environment variable OCT_OLLAMA_PREFIX to a different value.

NOTE: The final _ is added by the plugin, so it should not be included in the prefix.

IMPORTANT

Ollama needs to be installed separately and reachable from the server (check the link for instructions). The environment variable OCT_OLLAMA_ENDPOINT should be set to the endpoint of the ollama server (including the /api).

Example:

export OLLAMA_ENDPOINT=http://localhost:11434/api

Depending on the RAM available on your system (CPU/GPU), you also may need to tune the variables

  • OLLAMA_MAX_LOADED_MODELS
  • OLLAMA_NUM_PARALLEL

when running the server.

For more information, check the ollama FAQ

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ocr_translate_ollama-0.1.4.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

ocr_translate_ollama-0.1.4-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file ocr_translate_ollama-0.1.4.tar.gz.

File metadata

  • Download URL: ocr_translate_ollama-0.1.4.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for ocr_translate_ollama-0.1.4.tar.gz
Algorithm Hash digest
SHA256 519481c8062a589e209d871561b4e790da278c948f26257bc77820d81ef8b0fb
MD5 51a148f784eef2940dbd9ca28b5132b8
BLAKE2b-256 018d146131e98c0183b918a6512238f89b13293361f20e3bf8a3947d519c2e3f

See more details on using hashes here.

File details

Details for the file ocr_translate_ollama-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for ocr_translate_ollama-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 32c99f5cae0a391ef45be210da91653d81ae2fe41e6cf69f9da7f846a7643d34
MD5 73540df2bf6d49b849004ce3004f4cc3
BLAKE2b-256 ef13208d233825df0af95e5a4ce3c6883ff95144d7cc9c940221c50eae8fe98a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page