AI Module
This module contains AI-powered features for video processing.
Detection
Tracking
Speech Recognition
Translation
Translation module for FMUS-VID.
This module provides classes for translating text using local LLMs like Ollama.
- class fmusvid.ai.translation.LLMTranslator(model='ollama:mistral', target_languages=None, source_language='en', host='http://localhost:11434', prompt_template=None, temperature=0.3, context_window=8192, max_length=200, batch_size=1, timeout=10.0, throttle_time=0.1, cache_size=1000)[source]
Translate text using local large language models.
This class provides translation capabilities using local LLMs like Ollama.
- __init__(model='ollama:mistral', target_languages=None, source_language='en', host='http://localhost:11434', prompt_template=None, temperature=0.3, context_window=8192, max_length=200, batch_size=1, timeout=10.0, throttle_time=0.1, cache_size=1000)[source]
Initialize the LLM translator.
- Parameters:
model (
str) – LLM model identifier (e.g., ‘ollama:mistral’, ‘ollama:llama2’)target_languages (
Optional[List[str]]) – List of target language codes (ISO 639-1)source_language (
str) – Source language code (ISO 639-1)host (
str) – Host URL for the LLM serviceprompt_template (
Optional[str]) – Custom prompt template (None for default)temperature (
float) – Sampling temperature (0.0 to 1.0)context_window (
int) – Maximum context window size in tokensmax_length (
int) – Maximum length of translation in tokensbatch_size (
int) – Number of translations to process in a batchtimeout (
float) – Timeout for translation requests in secondsthrottle_time (
float) – Time to wait between translation requestscache_size (
int) – Size of translation cache
- async translate_async(text, target_languages=None)[source]
Translate text to multiple languages asynchronously.