futranbg commited on
Commit
7dbe2e1
·
1 Parent(s): 3a0e917

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -22,12 +22,11 @@ def s2t(audio, model_name):
22
  yield text
23
 
24
  with gr.Blocks() as demo:
25
- with gr.Column():
26
- voice = gr.Audio(sources=["microphone"], type="filepath", label="Voice")
27
- audio = gr.Audio(sources=["upload"], type="filepath", label="Audio file")
28
- model_name = gr.Dropdown(
29
- label="Models:",
30
- choices=[
31
  "openai/whisper-large-v3",
32
  "openai/whisper-large-v2",
33
  "openai/whisper-large",
@@ -35,13 +34,14 @@ with gr.Blocks() as demo:
35
  "openai/whisper-small",
36
  "openai/whisper-base",
37
  "openai/whisper-tiny",
38
- ],
39
- value="openai/whisper-large-v3",
40
- )
41
- with gr.Column():
42
- output = gr.Textbox(label="Transcription results")
 
 
43
 
44
- voice.stop_recording(s2t, inputs=[voice, model_name], outputs=output)
45
- audio.upload(s2t, inputs=[audio, model_name], outputs=output)
46
 
47
  demo.queue().launch(max_threads=4)
 
22
  yield text
23
 
24
  with gr.Blocks() as demo:
25
+ with gr.Row():
26
+ with gr.Column():
27
+ model_name = gr.Dropdown(
28
+ label="Models:",
29
+ choices=[
 
30
  "openai/whisper-large-v3",
31
  "openai/whisper-large-v2",
32
  "openai/whisper-large",
 
34
  "openai/whisper-small",
35
  "openai/whisper-base",
36
  "openai/whisper-tiny",
37
+ ],
38
+ value="openai/whisper-large-v3",
39
+ )
40
+ audio = gr.Audio(sources=["microphone","upload"], type="filepath", label="Audio")
41
+
42
+ with gr.Column():
43
+ output = gr.Textbox(label="Transcription results")
44
 
45
+ audio.change(s2t, inputs=[audio, model_name], outputs=output)
 
46
 
47
  demo.queue().launch(max_threads=4)