Fix whisper auto bug

This commit is contained in:
2025-09-07 13:45:00 +02:00
parent efe166a4ff
commit 420442506a
2 changed files with 12 additions and 3 deletions

View File

@@ -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.