Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -73,7 +73,7 @@ def translation(source, target, text):
|
|
73 |
return result
|
74 |
|
75 |
|
76 |
-
def transcribe(inputs, task):
|
77 |
if inputs is None:
|
78 |
raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
|
79 |
|
@@ -151,8 +151,8 @@ lang_codes = list(flores_codes.keys())
|
|
151 |
mf_transcribe = gr.Interface(
|
152 |
fn=transcribe,
|
153 |
inputs=[
|
154 |
-
Audio(source="microphone", type="filepath"
|
155 |
-
Radio(["transcribe", "translate"], label="Task"
|
156 |
Dropdown(lang_codes, default='English', label='Source'),
|
157 |
Dropdown(lang_codes, default='French', label='Target'),
|
158 |
],
|
@@ -171,8 +171,8 @@ mf_transcribe = gr.Interface(
|
|
171 |
file_transcribe = gr.Interface(
|
172 |
fn=transcribe,
|
173 |
inputs=[
|
174 |
-
Audio(source="upload", type="filepath",
|
175 |
-
Radio(["transcribe", "translate"], label="Task"
|
176 |
Dropdown(lang_codes, default='English', label='Source'),
|
177 |
Dropdown(lang_codes, default='French', label='Target'),
|
178 |
],
|
@@ -192,9 +192,9 @@ 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"
|
196 |
-
Dropdown(lang_codes, default='English', label='Source
|
197 |
-
Dropdown(lang_codes, default='French', label='Target
|
198 |
],
|
199 |
outputs=[Textbox(label="html"), Textbox(label="Transcribed Text"), Textbox(label="Translated Text")],
|
200 |
layout="horizontal",
|
@@ -211,5 +211,5 @@ yt_transcribe = gr.Interface(
|
|
211 |
with demo:
|
212 |
gr.TabbedInterface([mf_transcribe, file_transcribe, yt_transcribe], ["Microphone", "Audio file", "YouTube"])
|
213 |
|
214 |
-
demo.launch(
|
215 |
|
|
|
73 |
return result
|
74 |
|
75 |
|
76 |
+
def transcribe(inputs, task, source, target):
|
77 |
if inputs is None:
|
78 |
raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
|
79 |
|
|
|
151 |
mf_transcribe = gr.Interface(
|
152 |
fn=transcribe,
|
153 |
inputs=[
|
154 |
+
Audio(source="microphone", type="filepath"),
|
155 |
+
Radio(["transcribe", "translate"], label="Task"),
|
156 |
Dropdown(lang_codes, default='English', label='Source'),
|
157 |
Dropdown(lang_codes, default='French', label='Target'),
|
158 |
],
|
|
|
171 |
file_transcribe = gr.Interface(
|
172 |
fn=transcribe,
|
173 |
inputs=[
|
174 |
+
Audio(source="upload", type="filepath", label="Audio file"),
|
175 |
+
Radio(["transcribe", "translate"], label="Task"),
|
176 |
Dropdown(lang_codes, default='English', label='Source'),
|
177 |
Dropdown(lang_codes, default='French', label='Target'),
|
178 |
],
|
|
|
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"),
|
196 |
+
Dropdown(lang_codes, default='English', label='Source'),
|
197 |
+
Dropdown(lang_codes, default='French', label='Target'),
|
198 |
],
|
199 |
outputs=[Textbox(label="html"), Textbox(label="Transcribed Text"), Textbox(label="Translated Text")],
|
200 |
layout="horizontal",
|
|
|
211 |
with demo:
|
212 |
gr.TabbedInterface([mf_transcribe, file_transcribe, yt_transcribe], ["Microphone", "Audio file", "YouTube"])
|
213 |
|
214 |
+
demo.launch().queue()
|
215 |
|