yvankob commited on
Commit
e5df979
·
1 Parent(s): 3961f9a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -32
app.py CHANGED
@@ -195,40 +195,42 @@ def yt_transcribe(yt_url, task, max_filesize=75.0):
195
  # Interfaces
196
  demo = gr.Blocks()
197
 
198
- with demo:
199
- with gr.Tab("Microphone"):
200
- gr.Interface(
201
- fn=gradio_interface,
202
- inputs=[
203
- gr.Audio(sources=["microphone"], type="filepath"),
204
- gr.Dropdown(lang_codes, value='French', label='Source Language'),
205
- gr.Dropdown(lang_codes, value='English', label='Target Language')],
206
- outputs=[gr.Textbox(label="Transcribed Text"), gr.Textbox(label="Translated Text")]
207
- )
208
-
209
- with gr.Tab("Audio file"):
210
- gr.Interface(
211
- fn=gradio_interface,
212
- inputs=[
213
- gr.Audio(type="filepath", label="Audio file"),
214
- gr.Dropdown(lang_codes, value='French', label='Source Language'),
215
- gr.Dropdown(lang_codes, value='English', label='Target Language')],
216
- outputs=[gr.Textbox(label="Transcribed Text"), gr.Textbox(label="Translated Text")]
217
- )
218
-
219
- with gr.Tab("YouTube"):
220
- gr.Interface(
221
- fn=yt_transcribe,
222
- inputs=[
223
- gr.Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL"),
224
- gr.Dropdown(lang_codes, value='French', label='Source Language'),
225
- gr.Dropdown(lang_codes, value='English', label='Target Language')
226
- ],
227
- outputs=["html", gr.Textbox(label="Transcribed Text"), gr.Textbox(label="Translated Text")]
228
- )
 
 
229
 
230
  with demo:
231
  gr.TabbedInterface([mf_transcribe, file_transcribe, yt_transcribe], ["Microphone", "Audio file", "YouTube"])
232
 
233
- demo.launch()
234
 
 
 
195
  # Interfaces
196
  demo = gr.Blocks()
197
 
198
+ mf_transcribe = gr.Interface(
199
+ fn=gradio_interface,
200
+ inputs=[
201
+ gr.Audio(sources=["microphone"], type="filepath"),
202
+ gr.Dropdown(lang_codes, value='French', label='Source Language'),
203
+ gr.Dropdown(lang_codes, value='English', label='Target Language')
204
+ ],
205
+ outputs=[
206
+ gr.Textbox(label="Transcribed Text"),
207
+ gr.Textbox(label="Translated Text")]
208
+ )
209
+
210
+ file_transcribe = gr.Interface(
211
+ fn=gradio_interface,
212
+ inputs=[
213
+ gr.Audio(type="filepath", label="Audio file"),
214
+ gr.Dropdown(lang_codes, value='French', label='Source Language'),
215
+ gr.Dropdown(lang_codes, value='English', label='Target Language')
216
+ ],
217
+ outputs=[
218
+ gr.Textbox(label="Transcribed Text"),
219
+ gr.Textbox(label="Translated Text")]
220
+ )
221
+
222
+ yt_transcribe = gr.Interface(
223
+ fn=yt_transcribe,
224
+ inputs=[
225
+ gr.Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL"),
226
+ gr.Dropdown(lang_codes, value='French', label='Source Language'),
227
+ gr.Dropdown(lang_codes, value='English', label='Target Language')
228
+ ],
229
+ outputs=["html", gr.Textbox(label="Transcribed Text"), gr.Textbox(label="Translated Text")]
230
+ )
231
 
232
  with demo:
233
  gr.TabbedInterface([mf_transcribe, file_transcribe, yt_transcribe], ["Microphone", "Audio file", "YouTube"])
234
 
 
235
 
236
+ demo.launch()