Commit
59b71d1
·
verified ·
1 Parent(s): 763786a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -36,7 +36,7 @@ def get_model(model_name):
36
  @spaces.GPU(duration=120)
37
  def transcribe_and_score(audio):
38
  if audio is None:
39
- return "", None
40
  model = get_model(MODEL_NAMES[0])
41
  predictions = model.transcribe([audio])
42
  item = predictions[0] if isinstance(predictions, list) else predictions
@@ -51,7 +51,7 @@ def transcribe_and_score(audio):
51
  else:
52
  text = str(item)
53
 
54
- return text.strip(), audio
55
 
56
  @spaces.GPU(duration=120)
57
  def batch_transcribe(audio_files):
@@ -86,10 +86,8 @@ with gr.Blocks(title="EgypTalk-ASR-v2") as demo:
86
  with gr.Row():
87
  audio_input = gr.Audio(sources=["microphone", "upload"], type="filepath", label="Audio")
88
  transcribe_btn = gr.Button("Transcribe")
89
- with gr.Row():
90
- pred_output = gr.Textbox(label="Transcription")
91
- audio_playback = gr.Audio(type="filepath", label="Playback")
92
- transcribe_btn.click(transcribe_and_score, inputs=[audio_input], outputs=[pred_output, audio_playback])
93
 
94
  with gr.Tab("Batch Test"):
95
  gr.Markdown("Upload multiple audio files. Batch size is limited by GPU/CPU memory.")
 
36
  @spaces.GPU(duration=120)
37
  def transcribe_and_score(audio):
38
  if audio is None:
39
+ return ""
40
  model = get_model(MODEL_NAMES[0])
41
  predictions = model.transcribe([audio])
42
  item = predictions[0] if isinstance(predictions, list) else predictions
 
51
  else:
52
  text = str(item)
53
 
54
+ return text.strip()
55
 
56
  @spaces.GPU(duration=120)
57
  def batch_transcribe(audio_files):
 
86
  with gr.Row():
87
  audio_input = gr.Audio(sources=["microphone", "upload"], type="filepath", label="Audio")
88
  transcribe_btn = gr.Button("Transcribe")
89
+ pred_output = gr.Textbox(label="Transcription")
90
+ transcribe_btn.click(transcribe_and_score, inputs=[audio_input], outputs=[pred_output])
 
 
91
 
92
  with gr.Tab("Batch Test"):
93
  gr.Markdown("Upload multiple audio files. Batch size is limited by GPU/CPU memory.")