sanchit-gandhi HF staff commited on
Commit
f378d98
1 Parent(s): f7768d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -3,15 +3,20 @@ import gradio as gr
3
  def identity(audio):
4
  return audio, audio
5
 
 
 
 
6
  with gr.Blocks() as demo:
7
  with gr.Row():
8
  with gr.Column():
9
  audio_in = gr.Audio(sources=["microphone"], type="filepath")
10
- run_button = gr.Button("Generate audio")
11
  with gr.Column():
12
  audio_out = gr.Audio(type="filepath")
13
  path_out = gr.Textbox(label="audio filepath")
14
 
 
 
15
  run_button.click(fn=identity, inputs=[audio_in], outputs=[audio_out, path_out])
16
 
17
  demo.launch()
 
3
  def identity(audio):
4
  return audio, audio
5
 
6
+ def enable_button():
7
+ return gr.Button(interactive=True)
8
+
9
  with gr.Blocks() as demo:
10
  with gr.Row():
11
  with gr.Column():
12
  audio_in = gr.Audio(sources=["microphone"], type="filepath")
13
+ run_button = gr.Button("Generate audio", interactive=False) # Start with the button disabled
14
  with gr.Column():
15
  audio_out = gr.Audio(type="filepath")
16
  path_out = gr.Textbox(label="audio filepath")
17
 
18
+ # Enable the button on upload
19
+ audio.upload(fn=enable_button, outputs=button)
20
  run_button.click(fn=identity, inputs=[audio_in], outputs=[audio_out, path_out])
21
 
22
  demo.launch()