Spaces:
Runtime error
Runtime error
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() |