Update app.py
Browse files
app.py
CHANGED
|
@@ -505,6 +505,14 @@ def transcribe_endpoint():
|
|
| 505 |
GLOBAL_BOT_ID = updated_bot_id
|
| 506 |
GLOBAL_WORKSPACE_ID = updated_workspace_id
|
| 507 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 508 |
return jsonify({"transcription": transcription})
|
| 509 |
|
| 510 |
|
|
|
|
| 505 |
GLOBAL_BOT_ID = updated_bot_id
|
| 506 |
GLOBAL_WORKSPACE_ID = updated_workspace_id
|
| 507 |
|
| 508 |
+
# Check if we got an error string back
|
| 509 |
+
if isinstance(transcription, str) and (
|
| 510 |
+
transcription.startswith("Failed") or
|
| 511 |
+
transcription.startswith("Unable") or
|
| 512 |
+
transcription.startswith("The transcription is taking too long")
|
| 513 |
+
):
|
| 514 |
+
return jsonify({"error": transcription}), 500
|
| 515 |
+
|
| 516 |
return jsonify({"transcription": transcription})
|
| 517 |
|
| 518 |
|