Spaces:
Running
Running
Commit
·
bf0fd01
1
Parent(s):
fe80760
Add chunks in JSONResponse for URL transcribe
Browse files- app/main.py +7 -1
app/main.py
CHANGED
|
@@ -95,8 +95,14 @@ async def transcribe_url(payload: dict):
|
|
| 95 |
if MODEL is None:
|
| 96 |
MODEL = load_model(chunk_length_s=30)
|
| 97 |
text = transcribe_file(MODEL, tmp_wav, max_chunk_length=30.0, overlap_s=5.0)
|
|
|
|
| 98 |
info2 = get_audio_info(tmp_wav) or {}
|
| 99 |
-
return JSONResponse({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
except HTTPException:
|
| 101 |
raise
|
| 102 |
except Exception as e:
|
|
|
|
| 95 |
if MODEL is None:
|
| 96 |
MODEL = load_model(chunk_length_s=30)
|
| 97 |
text = transcribe_file(MODEL, tmp_wav, max_chunk_length=30.0, overlap_s=5.0)
|
| 98 |
+
chunks = transcribe_file_chunks(MODEL, tmp_wav, max_chunk_length=30.0, overlap_s=5.0)
|
| 99 |
info2 = get_audio_info(tmp_wav) or {}
|
| 100 |
+
return JSONResponse({
|
| 101 |
+
"text": text,
|
| 102 |
+
"duration": info2.get("duration"),
|
| 103 |
+
"sample_rate": info2.get("samplerate"),
|
| 104 |
+
"chunks": chunks
|
| 105 |
+
})
|
| 106 |
except HTTPException:
|
| 107 |
raise
|
| 108 |
except Exception as e:
|