Spaces:
Running on Zero

edwardgl commited on
Commit
84bee02
·
verified ·
1 Parent(s): 90e4342

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -269,8 +269,8 @@ with gr.Blocks(title="rumblex: word timestamps for Rumble-2-Flash") as demo:
269
  with gr.Column(scale=2, min_width=300):
270
  audio = gr.Audio(sources=["upload", "microphone"], type="filepath", label="Audio")
271
  language = gr.Dropdown(LANGUAGES, value="Auto-detect", label="Language", allow_custom_value=True)
272
- go = gr.Button("Transcribe", variant="primary", size="lg")
273
- example = gr.Button("▶ No audio handy? Try an example clip", variant="secondary")
274
  gr.Markdown("<small>The example is a 6 s LibriSpeech recording (CC BY 4.0).</small>")
275
  with gr.Column(scale=3, min_width=360):
276
  status = gr.Markdown()
@@ -284,7 +284,8 @@ with gr.Blocks(title="rumblex: word timestamps for Rumble-2-Flash") as demo:
284
  gr.Markdown(FOOTER)
285
  outputs = [status, transcript, table, files]
286
  go.click(run, [audio, language, width], outputs)
287
- # A microphone recording is transcribed as soon as the recording stops, without pressing the button.
 
288
  audio.stop_recording(run, [audio, language, width], outputs)
289
  # One click: load the example clip into the audio box and transcribe it.
290
  example.click(lambda: (EXAMPLE, "Auto-detect"), None, [audio, language]).then(
 
269
  with gr.Column(scale=2, min_width=300):
270
  audio = gr.Audio(sources=["upload", "microphone"], type="filepath", label="Audio")
271
  language = gr.Dropdown(LANGUAGES, value="Auto-detect", label="Language", allow_custom_value=True)
272
+ example = gr.Button("▶ No audio handy? Try an example clip", variant="primary", size="lg")
273
+ go = gr.Button("Transcribe again (e.g. after changing the language)", variant="secondary", size="sm")
274
  gr.Markdown("<small>The example is a 6 s LibriSpeech recording (CC BY 4.0).</small>")
275
  with gr.Column(scale=3, min_width=360):
276
  status = gr.Markdown()
 
284
  gr.Markdown(FOOTER)
285
  outputs = [status, transcript, table, files]
286
  go.click(run, [audio, language, width], outputs)
287
+ # Uploads and microphone recordings are transcribed straight away, without pressing a button.
288
+ audio.upload(run, [audio, language, width], outputs)
289
  audio.stop_recording(run, [audio, language, width], outputs)
290
  # One click: load the example clip into the audio box and transcribe it.
291
  example.click(lambda: (EXAMPLE, "Auto-detect"), None, [audio, language]).then(