Spaces:
Runtime error
Runtime error
File size: 739 Bytes
ee96c3c bce9727 ee96c3c bce9727 ee96c3c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import gradio as gr
def toggle(choice):
if choice == "mic":
return gr.update(visible=True), gr.update(visible=False)
else:
return gr.update(visible=False), gr.update(visible=True)
with gr.Blocks() as demo:
with gr.Row():
with gr.Column():
r = gr.Radio(["mic", "file"], value="mic", label="How would you like to upload your audio?")
m = gr.Mic(label="Input")
f = gr.Audio(type="filepath", label="Input", visible=False)
with gr.Column():
output = gr.Audio(label="Output")
r.change(toggle, r, [m, f], queue=False, show_progress=False)
m.change(lambda x:x, m, output)
f.change(lambda x:x, f, output)
demo.queue()
demo.launch() |