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()