From 0c197324f5444b448c285d2a57bd0a5834c2fc84 Mon Sep 17 00:00:00 2001 From: historia Date: Thu, 20 Aug 2026 22:39:04 +0000 Subject: feat: warn on empty transcripts and missing whisper backend in server.json tool --- converter/tts.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'converter') diff --git a/converter/tts.py b/converter/tts.py index afb0655..142cf6d 100644 --- a/converter/tts.py +++ b/converter/tts.py @@ -179,6 +179,24 @@ def transcribe_reference_audio(audio_path: str, model_name: str = "base") -> Opt return None +def whisper_backend_available() -> Optional[str]: + """Return the name of an importable Whisper backend, or None. + + Checks faster_whisper first (preferred), then the openai-whisper + package, without importing the heavy model code: a bare import probe + is enough to tell whether the package is installed in the current + environment. Used by the make_audiocpp_server_json tool to warn when + neither is present (e.g. the wrong conda environment is active). + """ + for backend in ("faster_whisper", "whisper"): + try: + __import__(backend) + except ImportError: + continue + return backend + return None + + # Duration sanity check: a response whose audio is far shorter than its # word count implies is treated as silently truncated, fails the request, # and goes through the normal retry logic. 150 wpm is a typical spoken -- cgit v1.2.3