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

For versions of the server >=0.2

  • 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

For versions of the server >=0.6

  • Install through the server plugin manager

For versions of the server >=0.7

  • Install through the server plugin manager OR manually by running pip install ocr_translate-google

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.3.0.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ocr_translate_ollama-0.3.0-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ocr_translate_ollama-0.3.0.tar.gz
Algorithm Hash digest
SHA256 96461b8bb3ce95b03819ad4352bb3ab25ef97b625efe691e3d2c873a4ea36789
MD5 e8bb419033f9235822e44810c8a9ae34
BLAKE2b-256 991e88ae02e5291ac1f4cba5b37c9304f4d58bed78ad644518406699e3ad7749

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ocr_translate_ollama-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 248bc799caaaa9617f31ea54dbb0f03d67978f5fa55e082628d662016a091f2e
MD5 0735c5e7eeaa060300d04cb629cf881f
BLAKE2b-256 dd2c4f938631c57be7b8f922439da4446abeb97b68870132f62f8fe9a04912d4

See more details on using hashes here.

Supported by

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