diff options
Diffstat (limited to 'converter')
| -rw-r--r-- | converter/tts.py | 18 |
1 files changed, 18 insertions, 0 deletions
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 |
