Commit
·
76241f8
1
Parent(s):
ad6bdc6
small fixes
Browse files
app.py
CHANGED
|
@@ -59,43 +59,6 @@ css = """
|
|
| 59 |
.result_item_error {background-color:#ff7070;color:white;align-self:start}
|
| 60 |
"""
|
| 61 |
|
| 62 |
-
examples = [
|
| 63 |
-
[
|
| 64 |
-
"Chinese+English",
|
| 65 |
-
"csukuangfj/sherpa-onnx-paraformer-zh-2023-03-28",
|
| 66 |
-
"midc2020-cui-bao-qiu.mp4",
|
| 67 |
-
],
|
| 68 |
-
[
|
| 69 |
-
"English",
|
| 70 |
-
"whisper-tiny.en",
|
| 71 |
-
"midc2020-daniel-povey.mp4",
|
| 72 |
-
],
|
| 73 |
-
[
|
| 74 |
-
"English",
|
| 75 |
-
"whisper-tiny.en",
|
| 76 |
-
"President-Obama-on-the-Importance-of-Education.mp4",
|
| 77 |
-
],
|
| 78 |
-
[
|
| 79 |
-
"English",
|
| 80 |
-
"whisper-tiny.en",
|
| 81 |
-
"jobs-at-stanford.mp4",
|
| 82 |
-
],
|
| 83 |
-
[
|
| 84 |
-
"English",
|
| 85 |
-
"yfyeung/icefall-asr-multidataset-pruned_transducer_stateless7-2023-05-04",
|
| 86 |
-
"obama's-message-for-america's-students.mp4",
|
| 87 |
-
],
|
| 88 |
-
]
|
| 89 |
-
|
| 90 |
-
for _, _, name in examples:
|
| 91 |
-
filename = get_file(
|
| 92 |
-
"csukuangfj/vad",
|
| 93 |
-
name,
|
| 94 |
-
subfolder=".",
|
| 95 |
-
)
|
| 96 |
-
|
| 97 |
-
shutil.copyfile(filename, name)
|
| 98 |
-
|
| 99 |
|
| 100 |
def update_model_dropdown(language: str):
|
| 101 |
if language in language_to_models:
|
|
@@ -164,14 +127,10 @@ with demo:
|
|
| 164 |
value=language_choices[0],
|
| 165 |
)
|
| 166 |
|
| 167 |
-
model_choices = []
|
| 168 |
-
for models in language_to_models.values():
|
| 169 |
-
model_choices.extend(models)
|
| 170 |
-
|
| 171 |
logging.info(model_choices)
|
| 172 |
|
| 173 |
model_dropdown = gr.Dropdown(
|
| 174 |
-
choices=
|
| 175 |
label="Select a model",
|
| 176 |
value=language_to_models[language_choices[0]][0],
|
| 177 |
)
|
|
@@ -198,22 +157,6 @@ with demo:
|
|
| 198 |
output_info = gr.HTML(label="Info")
|
| 199 |
output_textbox = gr.Textbox(label="Recognized speech from uploaded file")
|
| 200 |
|
| 201 |
-
gr.Examples(
|
| 202 |
-
examples=examples,
|
| 203 |
-
inputs=[
|
| 204 |
-
language_radio,
|
| 205 |
-
model_dropdown,
|
| 206 |
-
uploaded_file,
|
| 207 |
-
],
|
| 208 |
-
outputs=[
|
| 209 |
-
output_video,
|
| 210 |
-
output_srt_file,
|
| 211 |
-
output_info,
|
| 212 |
-
output_textbox,
|
| 213 |
-
],
|
| 214 |
-
fn=process_uploaded_file,
|
| 215 |
-
)
|
| 216 |
-
|
| 217 |
upload_button.click(
|
| 218 |
process_uploaded_file,
|
| 219 |
inputs=[
|
|
|
|
| 59 |
.result_item_error {background-color:#ff7070;color:white;align-self:start}
|
| 60 |
"""
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
def update_model_dropdown(language: str):
|
| 64 |
if language in language_to_models:
|
|
|
|
| 127 |
value=language_choices[0],
|
| 128 |
)
|
| 129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
logging.info(model_choices)
|
| 131 |
|
| 132 |
model_dropdown = gr.Dropdown(
|
| 133 |
+
choices=language_to_models[language_choices[0]],
|
| 134 |
label="Select a model",
|
| 135 |
value=language_to_models[language_choices[0]][0],
|
| 136 |
)
|
|
|
|
| 157 |
output_info = gr.HTML(label="Info")
|
| 158 |
output_textbox = gr.Textbox(label="Recognized speech from uploaded file")
|
| 159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
upload_button.click(
|
| 161 |
process_uploaded_file,
|
| 162 |
inputs=[
|