From 420442506a02b3ca944c26b1ad3882c90058360e Mon Sep 17 00:00:00 2001 From: Tomas Kracmar Date: Sun, 7 Sep 2025 13:45:00 +0200 Subject: [PATCH] Fix whisper auto bug --- app/worker.py | 6 +++--- docker-compose.yml | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/worker.py b/app/worker.py index 88d9cd9..9db97d4 100644 --- a/app/worker.py +++ b/app/worker.py @@ -9,6 +9,7 @@ TRN = Path(os.getenv("TRANSCRIPT_ROOT", "/transcripts")) TMP = Path(os.getenv("TMP_ROOT", "/tmpdl")) MODEL_NAME = os.getenv("WHISPER_MODEL","large-v3") COMPUTE = os.getenv("WHISPER_PRECISION","int8") +WHISPER_LANGUAGE = os.getenv("WHISPER_LANGUAGE", "auto").strip() OWUI_URL = os.getenv("OPENWEBUI_URL", "").rstrip("/") OWUI_KEY = os.getenv("OPENWEBUI_API_KEY", "") @@ -78,7 +79,8 @@ def yt_dlp(url, outdir): def transcribe(media_path: Path): model = get_model() - segments, info = model.transcribe(str(media_path), vad_filter=True, language="auto") + lang = None if WHISPER_LANGUAGE.lower() == "auto" else WHISPER_LANGUAGE + segments, info = model.transcribe(str(media_path), vad_filter=True, language=lang) title = media_path.stem base = TRN / title segs, text_parts = [], [] @@ -231,8 +233,6 @@ def publish_to_openwebui(paths): except Exception as e: log({"status": "owui_error", "error": str(e)}) -from pathlib import Path - def handle_local_file(path_str: str): """Transcribe & index a local media file that already exists in /library. Safe to call repeatedly; it skips if transcript JSON already exists. diff --git a/docker-compose.yml b/docker-compose.yml index 9ac0a91..7d9942d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,6 +21,11 @@ services: restart: unless-stopped extra_hosts: - host.docker.internal:host-gateway + healthcheck: + test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:8080/health || exit 1"] + interval: 30s + timeout: 5s + retries: 3 podx-worker: build: ./app @@ -43,6 +48,8 @@ services: - ${MODELS_HOST_DIR:-./models}:/root/.cache/huggingface depends_on: [meili, redis] restart: unless-stopped + healthcheck: + test: ["CMD-SHELL", "exit 0"] extra_hosts: - host.docker.internal:host-gateway @@ -100,4 +107,6 @@ services: - ${LIBRARY_HOST_DIR:-./library}:/library - ${TRANSCRIPTS_HOST_DIR:-./transcripts}:/transcripts depends_on: [redis] + healthcheck: + test: ["CMD-SHELL", "exit 0"] restart: unless-stopped