Chan-Y commited on
Commit
5741b5e
1 Parent(s): 234c504

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -112,20 +112,20 @@ def create_gradio_interface():
112
  submit_btn.click(fn=on_text_submit, inputs=text_input, outputs=[lang_output, output_text, time_taken])
113
 
114
  with gr.Tab("Audio Input"):
115
- audio_input = gr.Audio(label="Upload Audio", type="filepath")
116
- youtube_input = gr.Textbox(label="YouTube URL")
117
- audio_output = gr.Textbox(label="Detected Topics from Audio")
118
- audio_submit_btn = gr.Button("Process Audio")
119
-
120
- def on_audio_submit(audio, youtube_url):
121
- if youtube_url:
122
- return handle_audio_input(youtube_url=youtube_url)
123
- elif audio:
124
- return handle_audio_input(audio_path=audio)
125
- else:
126
- return "Please provide either an audio file or a YouTube URL."
127
-
128
- audio_submit_btn.click(fn=on_audio_submit, inputs=[audio_input, youtube_input], outputs=audio_output)
129
  iface.launch()
130
 
131
  if __name__ == "__main__":
 
112
  submit_btn.click(fn=on_text_submit, inputs=text_input, outputs=[lang_output, output_text, time_taken])
113
 
114
  with gr.Tab("Audio Input"):
115
+ audio_input = gr.Audio(label="Upload Audio", type="filepath")
116
+ youtube_input = gr.Textbox(label="YouTube URL (will process URL first)")
117
+ audio_output = gr.Textbox(label="Detected Topics from Audio")
118
+ audio_submit_btn = gr.Button("Process Audio")
119
+
120
+ def on_audio_submit(audio, youtube_url):
121
+ if youtube_url:
122
+ return handle_audio_input(youtube_url=youtube_url)
123
+ elif audio:
124
+ return handle_audio_input(audio_path=audio)
125
+ else:
126
+ return "Please provide either an audio file or a YouTube URL."
127
+
128
+ audio_submit_btn.click(fn=on_audio_submit, inputs=[audio_input, youtube_input], outputs=audio_output)
129
  iface.launch()
130
 
131
  if __name__ == "__main__":