Fix whisper auto bug
This commit is contained in:
@@ -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.
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user