mic_or_file / app.py
abidlabs's picture
abidlabs HF staff
Create app.py
ee96c3c
raw
history blame contribute delete
No virus
692 Bytes
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])
m.change(lambda x:x, m, output)
f.change(lambda x:x, f, output)
demo.launch()