csukuangfj
commited on
Commit
•
a461307
1
Parent(s):
82e7fae
small fixes
Browse files
app.py
CHANGED
@@ -58,6 +58,7 @@ def build_html_output(s: str, style: str = "result_item_success"):
|
|
58 |
</div>
|
59 |
"""
|
60 |
|
|
|
61 |
def process_url(
|
62 |
language: str,
|
63 |
repo_id: str,
|
@@ -81,6 +82,7 @@ def process_url(
|
|
81 |
logging.info(str(e))
|
82 |
return "", build_html_output(str(e), "result_item_error")
|
83 |
|
|
|
84 |
def process_uploaded_file(
|
85 |
language: str,
|
86 |
repo_id: str,
|
@@ -228,7 +230,11 @@ css = """
|
|
228 |
def update_model_dropdown(language: str):
|
229 |
if language in language_to_models:
|
230 |
choices = language_to_models[language]
|
231 |
-
return gr.Dropdown.update(
|
|
|
|
|
|
|
|
|
232 |
|
233 |
raise ValueError(f"Unsupported language: {language}")
|
234 |
|
@@ -249,6 +255,7 @@ with demo:
|
|
249 |
choices=language_to_models[language_choices[0]],
|
250 |
label="Select a model",
|
251 |
value=language_to_models[language_choices[0]][0],
|
|
|
252 |
)
|
253 |
|
254 |
language_radio.change(
|
@@ -322,10 +329,10 @@ with demo:
|
|
322 |
|
323 |
with gr.TabItem("From URL"):
|
324 |
url_textbox = gr.Textbox(
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
)
|
330 |
|
331 |
url_button = gr.Button("Submit for recognition")
|
|
|
58 |
</div>
|
59 |
"""
|
60 |
|
61 |
+
|
62 |
def process_url(
|
63 |
language: str,
|
64 |
repo_id: str,
|
|
|
82 |
logging.info(str(e))
|
83 |
return "", build_html_output(str(e), "result_item_error")
|
84 |
|
85 |
+
|
86 |
def process_uploaded_file(
|
87 |
language: str,
|
88 |
repo_id: str,
|
|
|
230 |
def update_model_dropdown(language: str):
|
231 |
if language in language_to_models:
|
232 |
choices = language_to_models[language]
|
233 |
+
return gr.Dropdown.update(
|
234 |
+
choices=choices,
|
235 |
+
value=choices[0],
|
236 |
+
allow_custom_value=True,
|
237 |
+
)
|
238 |
|
239 |
raise ValueError(f"Unsupported language: {language}")
|
240 |
|
|
|
255 |
choices=language_to_models[language_choices[0]],
|
256 |
label="Select a model",
|
257 |
value=language_to_models[language_choices[0]][0],
|
258 |
+
allow_custom_value=True,
|
259 |
)
|
260 |
|
261 |
language_radio.change(
|
|
|
329 |
|
330 |
with gr.TabItem("From URL"):
|
331 |
url_textbox = gr.Textbox(
|
332 |
+
max_lines=1,
|
333 |
+
placeholder="URL to an audio file",
|
334 |
+
label="URL",
|
335 |
+
interactive=True,
|
336 |
)
|
337 |
|
338 |
url_button = gr.Button("Submit for recognition")
|
model.py
CHANGED
@@ -947,7 +947,7 @@ def _get_multi_zh_hans_pre_trained_model(
|
|
947 |
sample_rate=16000,
|
948 |
feature_dim=80,
|
949 |
decoding_method=decoding_method,
|
950 |
-
|
951 |
)
|
952 |
|
953 |
return recognizer
|
|
|
947 |
sample_rate=16000,
|
948 |
feature_dim=80,
|
949 |
decoding_method=decoding_method,
|
950 |
+
max_active_paths=num_active_paths,
|
951 |
)
|
952 |
|
953 |
return recognizer
|