Tri4 commited on
Commit
93157c8
·
verified ·
1 Parent(s): 8934c68

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -5
main.py CHANGED
@@ -59,11 +59,11 @@ def transcribe(audio_path):
59
  @app.route('/transcribe', methods=['POST'])
60
  def transcribe_audio():
61
  # Record the time when the request was received
62
- request_received_time = get_time()[0]
63
  print(f"Received request at /transcribe at {request_received_time}", flush=True)
64
 
65
  if 'audio' not in request.files:
66
- print("Error: No audio file provided")
67
  return jsonify({"error": "No audio file provided"}), 400
68
 
69
  audio_file = request.files['audio']
@@ -95,16 +95,16 @@ def transcribe_audio():
95
  print(f"Audio file removed from: {audio_path}", flush=True)
96
 
97
  # Record the time when the response is being sent
98
- response_sent_time = get_time()[0]
99
 
100
  # Return the transcription, detected language, and timing information
101
  print(f"Transcription: {transcription}, Language: {language}", flush=True)
102
  return jsonify({
103
  "transcription": transcription,
104
  "language": language,
105
- "request_received_time": request_received_time.isoformat(),
106
  "transcription_duration": transcription_duration,
107
- "response_sent_time": response_sent_time.isoformat(),
108
  "audio_file_size_bytes": audio_file_size
109
  }), 200
110
 
 
59
  @app.route('/transcribe', methods=['POST'])
60
  def transcribe_audio():
61
  # Record the time when the request was received
62
+ request_received_time, _ = get_time()
63
  print(f"Received request at /transcribe at {request_received_time}", flush=True)
64
 
65
  if 'audio' not in request.files:
66
+ print("Error: No audio file provided", flush=True)
67
  return jsonify({"error": "No audio file provided"}), 400
68
 
69
  audio_file = request.files['audio']
 
95
  print(f"Audio file removed from: {audio_path}", flush=True)
96
 
97
  # Record the time when the response is being sent
98
+ response_sent_time, _ = get_time()
99
 
100
  # Return the transcription, detected language, and timing information
101
  print(f"Transcription: {transcription}, Language: {language}", flush=True)
102
  return jsonify({
103
  "transcription": transcription,
104
  "language": language,
105
+ "request_received_time": request_received_time,
106
  "transcription_duration": transcription_duration,
107
+ "response_sent_time": response_sent_time,
108
  "audio_file_size_bytes": audio_file_size
109
  }), 200
110