Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,8 +10,6 @@ from flores200_codes import flores_codes
|
|
10 |
import tempfile
|
11 |
import os
|
12 |
|
13 |
-
global model_dict
|
14 |
-
model_dict = load_models()
|
15 |
|
16 |
MODEL_NAME = "openai/whisper-large-v2"
|
17 |
BATCH_SIZE = 8
|
@@ -79,7 +77,7 @@ def transcribe(inputs, task):
|
|
79 |
raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
|
80 |
|
81 |
text = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=True)["text"]
|
82 |
-
translated_text = translation(source, target, text)
|
83 |
return text, translated_text
|
84 |
|
85 |
|
@@ -136,11 +134,14 @@ def yt_transcribe(yt_url, task, max_filesize=75.0):
|
|
136 |
inputs = {"array": inputs, "sampling_rate": pipe.feature_extractor.sampling_rate}
|
137 |
|
138 |
text = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=True)["text"]
|
139 |
-
translated_text = translation(source, target, text)
|
140 |
|
141 |
return html_embed_str, text, translated_text
|
142 |
|
143 |
|
|
|
|
|
|
|
144 |
|
145 |
demo = gr.Blocks()
|
146 |
|
|
|
10 |
import tempfile
|
11 |
import os
|
12 |
|
|
|
|
|
13 |
|
14 |
MODEL_NAME = "openai/whisper-large-v2"
|
15 |
BATCH_SIZE = 8
|
|
|
77 |
raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
|
78 |
|
79 |
text = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=True)["text"]
|
80 |
+
translated_text = translation(source, target, text)
|
81 |
return text, translated_text
|
82 |
|
83 |
|
|
|
134 |
inputs = {"array": inputs, "sampling_rate": pipe.feature_extractor.sampling_rate}
|
135 |
|
136 |
text = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=True)["text"]
|
137 |
+
translated_text = translation(source, target, text)
|
138 |
|
139 |
return html_embed_str, text, translated_text
|
140 |
|
141 |
|
142 |
+
global model_dict
|
143 |
+
model_dict = load_models()
|
144 |
+
|
145 |
|
146 |
demo = gr.Blocks()
|
147 |
|