EladSpamson commited on
Commit
2eaa4e3
·
verified ·
1 Parent(s): abb95e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -22,7 +22,8 @@ def transcribe_audio(audio_url):
22
  f.write(response.content)
23
 
24
  waveform, sr = librosa.load(audio_path, sr=16000)
25
- waveform = waveform[:sr * 3600]
 
26
 
27
  chunk_duration_sec = 25
28
  chunk_size = sr * chunk_duration_sec
@@ -46,4 +47,10 @@ def transcribe_endpoint():
46
  data = request.get_json()
47
  audio_url = data.get('audio_url')
48
  if not audio_url:
49
- return jsonify({"error": "
 
 
 
 
 
 
 
22
  f.write(response.content)
23
 
24
  waveform, sr = librosa.load(audio_path, sr=16000)
25
+ max_duration_sec = 3600
26
+ waveform = waveform[:sr * max_duration_sec]
27
 
28
  chunk_duration_sec = 25
29
  chunk_size = sr * chunk_duration_sec
 
47
  data = request.get_json()
48
  audio_url = data.get('audio_url')
49
  if not audio_url:
50
+ return jsonify({"error": "Missing 'audio_url' in request"}), 400
51
+
52
+ transcription = transcribe_audio(audio_url)
53
+ return jsonify({"transcription": transcription})
54
+
55
+ if __name__ == '__main__':
56
+ app.run(host="0.0.0.0", port=7860)