yvankob commited on
Commit
5f6a271
·
1 Parent(s): 142d3f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -15
app.py CHANGED
@@ -6,6 +6,7 @@ from transformers import pipeline
6
  from transformers.pipelines.audio_utils import ffmpeg_read
7
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
8
  from flores200_codes import flores_codes
 
9
 
10
  import tempfile
11
  import os
@@ -150,12 +151,12 @@ lang_codes = list(flores_codes.keys())
150
  mf_transcribe = gr.Interface(
151
  fn=transcribe,
152
  inputs=[
153
- gr.inputs.Audio(source="microphone", type="filepath", optional=True),
154
- gr.inputs.Radio(["transcribe", "translate"], label="Task", default="transcribe"),
155
- gr.inputs.Dropdown(lang_codes, default='English', label='Source Language'),
156
- gr.inputs.Dropdown(lang_codes, default='French', label='Target Language'),
157
  ],
158
- outputs=["text", "text"],
159
  layout="horizontal",
160
  theme="huggingface",
161
  title="Whisper Large V2: Transcribe Audio",
@@ -170,12 +171,12 @@ mf_transcribe = gr.Interface(
170
  file_transcribe = gr.Interface(
171
  fn=transcribe,
172
  inputs=[
173
- gr.inputs.Audio(source="upload", type="filepath", optional=True, label="Audio file"),
174
- gr.inputs.Radio(["transcribe", "translate"], label="Task", default="transcribe"),
175
- gr.inputs.Dropdown(lang_codes, default='English', label='Source'),
176
- gr.inputs.Dropdown(lang_codes, default='French', label='Target'),
177
  ],
178
- outputs="text",
179
  layout="horizontal",
180
  theme="huggingface",
181
  title="Whisper Large V2: Transcribe Audio",
@@ -190,12 +191,12 @@ file_transcribe = gr.Interface(
190
  yt_transcribe = gr.Interface(
191
  fn=yt_transcribe,
192
  inputs=[
193
- gr.inputs.Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL"),
194
- gr.inputs.Radio(["transcribe", "translate"], label="Task", default="transcribe"),
195
- gr.inputs.Dropdown(lang_codes, default='English', label='Source Language'),
196
- gr.inputs.Dropdown(lang_codes, default='French', label='Target Language'),
197
  ],
198
- outputs=["html", "text", "translated_text"],
199
  layout="horizontal",
200
  theme="huggingface",
201
  title="Whisper Large V2: Transcribe YouTube",
 
6
  from transformers.pipelines.audio_utils import ffmpeg_read
7
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
8
  from flores200_codes import flores_codes
9
+ from gradio.components import Audio, Dropdown, Radio, Textbox
10
 
11
  import tempfile
12
  import os
 
151
  mf_transcribe = gr.Interface(
152
  fn=transcribe,
153
  inputs=[
154
+ Audio(source="microphone", type="filepath", optional=True),
155
+ Radio(["transcribe", "translate"], label="Task", default="transcribe"),
156
+ Dropdown(lang_codes, default='English', label='Source'),
157
+ Dropdown(lang_codes, default='French', label='Target'),
158
  ],
159
+ outputs=[Textbox(label="Transcribed Text"), Textbox(label="Translated Text")],
160
  layout="horizontal",
161
  theme="huggingface",
162
  title="Whisper Large V2: Transcribe Audio",
 
171
  file_transcribe = gr.Interface(
172
  fn=transcribe,
173
  inputs=[
174
+ Audio(source="upload", type="filepath", optional=True, label="Audio file"),
175
+ Radio(["transcribe", "translate"], label="Task", default="transcribe"),
176
+ Dropdown(lang_codes, default='English', label='Source'),
177
+ Dropdown(lang_codes, default='French', label='Target'),
178
  ],
179
+ outputs=[Textbox(label="Transcribed Text"), Textbox(label="Translated Text")],
180
  layout="horizontal",
181
  theme="huggingface",
182
  title="Whisper Large V2: Transcribe Audio",
 
191
  yt_transcribe = gr.Interface(
192
  fn=yt_transcribe,
193
  inputs=[
194
+ Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL"),
195
+ Radio(["transcribe", "translate"], label="Task", default="transcribe"),
196
+ Dropdown(lang_codes, default='English', label='Source Language'),
197
+ Dropdown(lang_codes, default='French', label='Target Language'),
198
  ],
199
+ outputs=[Textbox(label="html"), Textbox(label="Transcribed Text"), Textbox(label="Translated Text")],
200
  layout="horizontal",
201
  theme="huggingface",
202
  title="Whisper Large V2: Transcribe YouTube",