Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
],
|
158 |
-
outputs=["
|
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 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
],
|
178 |
-
outputs="
|
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 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
],
|
198 |
-
outputs=["html", "
|
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",
|