diff --git a/tools/transcription_tools.py b/tools/transcription_tools.py index d8d0f3643..d473172a3 100644 --- a/tools/transcription_tools.py +++ b/tools/transcription_tools.py @@ -295,7 +295,13 @@ def _transcribe_local(file_path: str, model_name: str) -> Dict[str, Any]: _local_model = WhisperModel(model_name, device="auto", compute_type="auto") _local_model_name = model_name - segments, info = _local_model.transcribe(file_path, beam_size=5) + # Allow forcing the language via env var (e.g. HERMES_LOCAL_STT_LANGUAGE=en) + _forced_lang = os.getenv(LOCAL_STT_LANGUAGE_ENV, DEFAULT_LOCAL_STT_LANGUAGE) + transcribe_kwargs = {"beam_size": 5} + if _forced_lang: + transcribe_kwargs["language"] = _forced_lang + + segments, info = _local_model.transcribe(file_path, **transcribe_kwargs) transcript = " ".join(segment.text.strip() for segment in segments) logger.info(