Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
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__":
|