Update main.py
Browse files
main.py
CHANGED
@@ -63,7 +63,7 @@ def transcribe(audio_path):
|
|
63 |
result = whisper.decode(model, mel, options)
|
64 |
|
65 |
print(" Transcription complete.", flush=True)
|
66 |
-
return result.text, language
|
67 |
|
68 |
@app.route('/transcribe', methods=['POST'])
|
69 |
def transcribe_audio():
|
@@ -91,7 +91,7 @@ def transcribe_audio():
|
|
91 |
|
92 |
# Transcribe the audio
|
93 |
try:
|
94 |
-
transcription, language = transcribe(audio_path)
|
95 |
except Exception as e:
|
96 |
print(f" Error during transcription: {str(e)}", flush=True)
|
97 |
return jsonify({"error": f"An error occurred: {str(e)}"}), 500
|
@@ -114,6 +114,7 @@ def transcribe_audio():
|
|
114 |
return jsonify({
|
115 |
"transcription": transcription,
|
116 |
"language": language,
|
|
|
117 |
"request_received_time": request_received_time,
|
118 |
"transcription_duration_seconds": transcription_duration,
|
119 |
"response_sent_time": response_sent_time,
|
|
|
63 |
result = whisper.decode(model, mel, options)
|
64 |
|
65 |
print(" Transcription complete.", flush=True)
|
66 |
+
return result.text, language, result
|
67 |
|
68 |
@app.route('/transcribe', methods=['POST'])
|
69 |
def transcribe_audio():
|
|
|
91 |
|
92 |
# Transcribe the audio
|
93 |
try:
|
94 |
+
transcription, language, srt = transcribe(audio_path)
|
95 |
except Exception as e:
|
96 |
print(f" Error during transcription: {str(e)}", flush=True)
|
97 |
return jsonify({"error": f"An error occurred: {str(e)}"}), 500
|
|
|
114 |
return jsonify({
|
115 |
"transcription": transcription,
|
116 |
"language": language,
|
117 |
+
"srt": srt,
|
118 |
"request_received_time": request_received_time,
|
119 |
"transcription_duration_seconds": transcription_duration,
|
120 |
"response_sent_time": response_sent_time,
|