abidlabs HF staff commited on
Commit
ee96c3c
·
1 Parent(s): 0e2e5b6

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def toggle(choice):
4
+ if choice == "mic":
5
+ return gr.update(visible=True), gr.update(visible=False)
6
+ else:
7
+ return gr.update(visible=False), gr.update(visible=True)
8
+
9
+
10
+ with gr.Blocks() as demo:
11
+ with gr.Row():
12
+ with gr.Column():
13
+ r = gr.Radio(["mic", "file"], value="mic", label="How would you like to upload your audio?")
14
+ m = gr.Mic(label="Input")
15
+ f = gr.Audio(type="filepath", label="Input", visible=False)
16
+ with gr.Column():
17
+ output = gr.Audio(label="Output")
18
+
19
+ r.change(toggle, r, [m, f])
20
+ m.change(lambda x:x, m, output)
21
+ f.change(lambda x:x, f, output)
22
+
23
+ demo.launch()