Spaces:
Runtime error
Runtime error
Create app.py
Browse files
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()
|