Spaces:
Paused
Paused
cstr commited on
Commit ·
aba48af
1
Parent(s): 35535ca
fix: correct crispasr cache_ensure_file call + upload source label
Browse filescache_ensure_file() requires both filename and url. Use
registry_lookup_by_filename() to get the URL from CrispASR's built-in
registry before downloading, and surface a clear gr.Error if the model
name is unknown.
Also: show 'Source: uploaded file' instead of 'Download Method: yt-dlp'
in verbose output when the user uploads a file rather than a URL.
app.py
CHANGED
|
@@ -663,8 +663,9 @@ def transcribe_audio(audio_input, audio_url, proxy_url, proxy_username, proxy_pa
|
|
| 663 |
else:
|
| 664 |
logging.getLogger().setLevel(logging.WARNING)
|
| 665 |
|
| 666 |
-
logging.info(f"Transcription parameters: pipeline_type={pipeline_type}, model_id={model_id}, dtype={dtype}, batch_size={batch_size}
|
| 667 |
-
|
|
|
|
| 668 |
|
| 669 |
if verbose:
|
| 670 |
yield verbose_messages, "", None
|
|
@@ -747,15 +748,20 @@ def transcribe_audio(audio_input, audio_url, proxy_url, proxy_username, proxy_pa
|
|
| 747 |
elif pipeline_type == "crispasr":
|
| 748 |
actual_model_path = model_id
|
| 749 |
if model_id == "auto":
|
| 750 |
-
# For demo purposes, we'll auto-resolve a decent model if 'auto' is picked
|
| 751 |
-
# In a real CLI it would prompt, here we just pick qwen3-asr-0.6b
|
| 752 |
actual_model_path = "qwen3-asr-0.6b.gguf"
|
| 753 |
-
|
| 754 |
-
# Check if it's a local file, if not try to ensure it's in cache
|
| 755 |
if not os.path.exists(actual_model_path):
|
| 756 |
-
|
| 757 |
-
|
| 758 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 759 |
model_or_pipeline = crispasr.CrispASR(actual_model_path)
|
| 760 |
else:
|
| 761 |
error_msg = "Invalid pipeline type"
|
|
|
|
| 663 |
else:
|
| 664 |
logging.getLogger().setLevel(logging.WARNING)
|
| 665 |
|
| 666 |
+
logging.info(f"Transcription parameters: pipeline_type={pipeline_type}, model_id={model_id}, dtype={dtype}, batch_size={batch_size}")
|
| 667 |
+
source_label = f"Download Method: {download_method}" if (audio_url and audio_url.strip()) else "Source: uploaded file"
|
| 668 |
+
verbose_messages = f"Starting transcription with parameters:\nPipeline Type: {pipeline_type}\nModel ID: {model_id}\nData Type: {dtype}\nBatch Size: {batch_size}\n{source_label}\n"
|
| 669 |
|
| 670 |
if verbose:
|
| 671 |
yield verbose_messages, "", None
|
|
|
|
| 748 |
elif pipeline_type == "crispasr":
|
| 749 |
actual_model_path = model_id
|
| 750 |
if model_id == "auto":
|
|
|
|
|
|
|
| 751 |
actual_model_path = "qwen3-asr-0.6b.gguf"
|
| 752 |
+
|
|
|
|
| 753 |
if not os.path.exists(actual_model_path):
|
| 754 |
+
entry = crispasr.registry_lookup_by_filename(actual_model_path)
|
| 755 |
+
if entry is None:
|
| 756 |
+
raise gr.Error(
|
| 757 |
+
f"Model '{actual_model_path}' not found in the CrispASR registry. "
|
| 758 |
+
"Provide a local file path or choose a known model name."
|
| 759 |
+
)
|
| 760 |
+
logging.info(f"Downloading {entry.filename} (~{entry.approx_size}) from registry...")
|
| 761 |
+
actual_model_path = crispasr.cache_ensure_file(entry.filename, entry.url)
|
| 762 |
+
if not actual_model_path:
|
| 763 |
+
raise gr.Error(f"Failed to download model '{model_id}' from {entry.url}.")
|
| 764 |
+
|
| 765 |
model_or_pipeline = crispasr.CrispASR(actual_model_path)
|
| 766 |
else:
|
| 767 |
error_msg = "Invalid pipeline type"
|