Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -487,26 +487,41 @@ def health_check():
|
|
| 487 |
}
|
| 488 |
}
|
| 489 |
|
| 490 |
-
# ----------------
|
| 491 |
-
@app.get("/
|
| 492 |
-
async def
|
| 493 |
-
"""
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 507 |
}
|
| 508 |
-
|
| 509 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 510 |
|
| 511 |
# ---------------- Serve static files ------------------------------------
|
| 512 |
# UI static files (production build)
|
|
|
|
| 487 |
}
|
| 488 |
}
|
| 489 |
|
| 490 |
+
# ---------------- Test Endpoint -----------------
|
| 491 |
+
@app.get("/debug/test_audio")
|
| 492 |
+
async def debug_test_audio():
|
| 493 |
+
"""Son oluşturulan audio dosyalarını test et"""
|
| 494 |
+
import glob
|
| 495 |
+
|
| 496 |
+
# En son oluşturulan dosyaları bul
|
| 497 |
+
raw_files = glob.glob("/tmp/raw_audio_*.wav")
|
| 498 |
+
trimmed_files = glob.glob("/tmp/trimmed_audio_*.wav")
|
| 499 |
+
|
| 500 |
+
results = {}
|
| 501 |
+
|
| 502 |
+
if raw_files:
|
| 503 |
+
latest_raw = max(raw_files, key=os.path.getctime)
|
| 504 |
+
result = subprocess.run([
|
| 505 |
+
'python', '/app/stt/test_single_wav.py', latest_raw
|
| 506 |
+
], capture_output=True, text=True, cwd='/app/stt')
|
| 507 |
+
results['raw'] = {
|
| 508 |
+
'file': latest_raw,
|
| 509 |
+
'stdout': result.stdout,
|
| 510 |
+
'stderr': result.stderr
|
| 511 |
}
|
| 512 |
+
|
| 513 |
+
if trimmed_files:
|
| 514 |
+
latest_trimmed = max(trimmed_files, key=os.path.getctime)
|
| 515 |
+
result = subprocess.run([
|
| 516 |
+
'python', '/app/stt/test_single_wav.py', latest_trimmed
|
| 517 |
+
], capture_output=True, text=True, cwd='/app/stt')
|
| 518 |
+
results['trimmed'] = {
|
| 519 |
+
'file': latest_trimmed,
|
| 520 |
+
'stdout': result.stdout,
|
| 521 |
+
'stderr': result.stderr
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
return results
|
| 525 |
|
| 526 |
# ---------------- Serve static files ------------------------------------
|
| 527 |
# UI static files (production build)
|