Spaces:
Running
Running
fix: add wav2vec2 result handling and logging in analyze file processing
Browse files- app/routes/analyze.py +16 -0
app/routes/analyze.py
CHANGED
|
@@ -407,6 +407,21 @@ async def _analyze_file(
|
|
| 407 |
logger.warning(f"[{request_id}] CLAP failed: {e}")
|
| 408 |
warnings.append("clap_analysis_unavailable")
|
| 409 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 410 |
# FST detection (Layer 3) — async native
|
| 411 |
fst_result = None
|
| 412 |
try:
|
|
@@ -429,6 +444,7 @@ async def _analyze_file(
|
|
| 429 |
features, vocals,
|
| 430 |
clap_result=clap_result,
|
| 431 |
fst_result=fst_result,
|
|
|
|
| 432 |
)
|
| 433 |
|
| 434 |
processing_time = round(time.monotonic() - start_time, 3)
|
|
|
|
| 407 |
logger.warning(f"[{request_id}] CLAP failed: {e}")
|
| 408 |
warnings.append("clap_analysis_unavailable")
|
| 409 |
|
| 410 |
+
# Await wav2vec2 (ran in parallel)
|
| 411 |
+
wav2vec2_result = None
|
| 412 |
+
try:
|
| 413 |
+
wav2vec2_result = await wav2vec2_future
|
| 414 |
+
if wav2vec2_result.available:
|
| 415 |
+
logger.info(
|
| 416 |
+
f"[{request_id}] wav2vec2: "
|
| 417 |
+
f"p_ai={wav2vec2_result.p_ai:.3f}"
|
| 418 |
+
)
|
| 419 |
+
else:
|
| 420 |
+
logger.info(f"[{request_id}] wav2vec2 unavailable: {wav2vec2_result.error}")
|
| 421 |
+
except Exception as e:
|
| 422 |
+
logger.warning(f"[{request_id}] wav2vec2 failed: {e}")
|
| 423 |
+
warnings.append("wav2vec2_unavailable")
|
| 424 |
+
|
| 425 |
# FST detection (Layer 3) — async native
|
| 426 |
fst_result = None
|
| 427 |
try:
|
|
|
|
| 444 |
features, vocals,
|
| 445 |
clap_result=clap_result,
|
| 446 |
fst_result=fst_result,
|
| 447 |
+
wav2vec2_result=wav2vec2_result,
|
| 448 |
)
|
| 449 |
|
| 450 |
processing_time = round(time.monotonic() - start_time, 3)
|