File size: 769 Bytes
228eb99
 
22488de
f7768d9
228eb99
f378d98
 
 
228eb99
 
 
 
f378d98
228eb99
22488de
f7768d9
22488de
f378d98
ed0517d
c6c83bb
f7768d9
228eb99
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr

def identity(audio):
    return audio, audio

def enable_button():
    return gr.Button(interactive=True)

with gr.Blocks() as demo:
    with gr.Row():
        with gr.Column():
            audio_in = gr.Audio(sources=["microphone"], type="filepath")
            run_button = gr.Button("Generate audio", interactive=False)  # Start with the button disabled
        with gr.Column():
            audio_out = gr.Audio(type="filepath")
            path_out = gr.Textbox(label="audio filepath")

    # Enable the button on upload
    audio_in.stop_recording(fn=enable_button, outputs=run_button)
    audio_in.upload(fn=enable_button, outputs=run_button)
    run_button.click(fn=identity, inputs=[audio_in], outputs=[audio_out, path_out])

demo.launch()