Mardiyyah commited on
Commit
7f39ff6
Β·
verified Β·
1 Parent(s): 43b3237

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -26
app.py CHANGED
@@ -29,33 +29,35 @@ with gr.Blocks() as demo:
29
  and πŸ€— Transformers to transcribe audio files of max 30s length.
30
  """)
31
 
32
- with gr.Row():
33
- audio_input = gr.Audio(
34
- sources=["microphone", "upload"],
35
- type="numpy",
36
- label="🎀 Record or Upload Audio",
37
  interactive=True,
38
- max_length=30,
39
  )
40
-
41
- with gr.Row():
42
- submit_btn = gr.Button("Submit", variant="primary")
43
- clear_btn = gr.Button("Clear", variant="secondary")
44
-
45
- with gr.Row():
46
- output_text = gr.Textbox(
47
- label="πŸ“ Transcription Output",
48
- interactive=False,
49
- show_copy_button=True
50
- )
51
-
52
- with gr.Row():
53
- flag_btn = gr.Button("🚩 Flag this output as incorrect", size="sm")
54
- share_btn = gr.Button("πŸ”— Share", size="sm")
55
-
56
- #
57
- submit_btn.click(fn=transcribe, inputs=audio_input, outputs=output_text)
58
- clear_btn.click(fn=lambda: (None, ""), inputs=None, outputs=[audio_input, output_text])
59
- flag_btn.click(fn=lambda: "Thank you for your feedback.", inputs=None, outputs=output_text)
 
 
60
 
61
  demo.launch(share=True)
 
29
  and πŸ€— Transformers to transcribe audio files of max 30s length.
30
  """)
31
 
32
+ with gr.Column():
33
+ audio_in = gr.Audio(
34
+ label="🎀 Record or upload your audio",
35
+ type="filepath",
36
+ sources=["upload", "microphone"],
37
  interactive=True,
38
+ max_length=30
39
  )
40
+ with gr.Row():
41
+ submit_btn = gr.Button("Submit")
42
+ clear_btn = gr.Button("Clear")
43
+
44
+
45
+ with gr.Column():
46
+
47
+ transcription_txt = gr.Textbox(
48
+ label="πŸ“ Transcription",
49
+ interactive=False,
50
+ show_label=True,
51
+ show_copy_button=True,
52
+ )
53
+
54
+ with gr.Row():
55
+ flag_btn = gr.Button("🚩 Flag this output as incorrect", size="sm")
56
+ share_btn = gr.Button("πŸ”— Share", size="sm")
57
+
58
+ # Button wiring:
59
+ submit_btn.click(fn=transcribe, inputs=audio_in, outputs=transcription_txt)
60
+ flag_btn.click(fn=lambda: "Thank you for your feedback.", inputs=None, outputs=transcription_txt)
61
+ clear_btn.click(fn=lambda: (None, ""), inputs=None, outputs=[audio_input, transcription_txt])
62
 
63
  demo.launch(share=True)