Spaces:
Runtime error
Runtime error
Commit
·
4ec5f80
1
Parent(s):
360fd16
small fixes
Browse files
app.py
CHANGED
|
@@ -153,20 +153,16 @@ def process(
|
|
| 153 |
logging.info(f"Finished at {date_time} s. Elapsed: {end - start: .3f} s")
|
| 154 |
|
| 155 |
info = f"""
|
|
|
|
| 156 |
Wave duration : {duration: .3f} s <br/>
|
| 157 |
Processing time: {end - start: .3f} s <br/>
|
| 158 |
RTF: {end - start: .3f}/{duration: .3f} = {rtf:.3f} <br/>
|
| 159 |
"""
|
| 160 |
-
if rtf > 1:
|
| 161 |
-
info += (
|
| 162 |
-
"<br/>We are loading the model for the first run. "
|
| 163 |
-
"Please run again to measure the real RTF.<br/>"
|
| 164 |
-
)
|
| 165 |
|
| 166 |
logging.info(info)
|
| 167 |
logging.info(f"\nrepo_id: {repo_id}\nhyp: {text}")
|
| 168 |
|
| 169 |
-
return
|
| 170 |
|
| 171 |
|
| 172 |
title = "# Automatic Speech Recognition with Next-gen Kaldi"
|
|
@@ -250,7 +246,6 @@ with demo:
|
|
| 250 |
label="Upload from disk",
|
| 251 |
)
|
| 252 |
upload_button = gr.Button("Submit for recognition")
|
| 253 |
-
uploaded_output = gr.Textbox(label="Recognized speech from uploaded file")
|
| 254 |
uploaded_html_info = gr.HTML(label="Info")
|
| 255 |
|
| 256 |
gr.Examples(
|
|
@@ -262,7 +257,7 @@ with demo:
|
|
| 262 |
num_active_paths_slider,
|
| 263 |
uploaded_file,
|
| 264 |
],
|
| 265 |
-
outputs=[
|
| 266 |
fn=process_uploaded_file,
|
| 267 |
)
|
| 268 |
|
|
@@ -275,7 +270,6 @@ with demo:
|
|
| 275 |
)
|
| 276 |
|
| 277 |
record_button = gr.Button("Submit for recognition")
|
| 278 |
-
recorded_output = gr.Textbox(label="Recognized speech from recordings")
|
| 279 |
recorded_html_info = gr.HTML(label="Info")
|
| 280 |
|
| 281 |
gr.Examples(
|
|
@@ -287,7 +281,7 @@ with demo:
|
|
| 287 |
num_active_paths_slider,
|
| 288 |
microphone,
|
| 289 |
],
|
| 290 |
-
outputs=[
|
| 291 |
fn=process_microphone,
|
| 292 |
)
|
| 293 |
|
|
@@ -300,7 +294,7 @@ with demo:
|
|
| 300 |
num_active_paths_slider,
|
| 301 |
uploaded_file,
|
| 302 |
],
|
| 303 |
-
outputs=[
|
| 304 |
)
|
| 305 |
|
| 306 |
record_button.click(
|
|
@@ -312,7 +306,7 @@ with demo:
|
|
| 312 |
num_active_paths_slider,
|
| 313 |
microphone,
|
| 314 |
],
|
| 315 |
-
outputs=[
|
| 316 |
)
|
| 317 |
gr.Markdown(description)
|
| 318 |
|
|
|
|
| 153 |
logging.info(f"Finished at {date_time} s. Elapsed: {end - start: .3f} s")
|
| 154 |
|
| 155 |
info = f"""
|
| 156 |
+
Result: {tet}
|
| 157 |
Wave duration : {duration: .3f} s <br/>
|
| 158 |
Processing time: {end - start: .3f} s <br/>
|
| 159 |
RTF: {end - start: .3f}/{duration: .3f} = {rtf:.3f} <br/>
|
| 160 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
|
| 162 |
logging.info(info)
|
| 163 |
logging.info(f"\nrepo_id: {repo_id}\nhyp: {text}")
|
| 164 |
|
| 165 |
+
return build_html_output(info)
|
| 166 |
|
| 167 |
|
| 168 |
title = "# Automatic Speech Recognition with Next-gen Kaldi"
|
|
|
|
| 246 |
label="Upload from disk",
|
| 247 |
)
|
| 248 |
upload_button = gr.Button("Submit for recognition")
|
|
|
|
| 249 |
uploaded_html_info = gr.HTML(label="Info")
|
| 250 |
|
| 251 |
gr.Examples(
|
|
|
|
| 257 |
num_active_paths_slider,
|
| 258 |
uploaded_file,
|
| 259 |
],
|
| 260 |
+
outputs=[uploaded_html_info],
|
| 261 |
fn=process_uploaded_file,
|
| 262 |
)
|
| 263 |
|
|
|
|
| 270 |
)
|
| 271 |
|
| 272 |
record_button = gr.Button("Submit for recognition")
|
|
|
|
| 273 |
recorded_html_info = gr.HTML(label="Info")
|
| 274 |
|
| 275 |
gr.Examples(
|
|
|
|
| 281 |
num_active_paths_slider,
|
| 282 |
microphone,
|
| 283 |
],
|
| 284 |
+
outputs=[recorded_html_info],
|
| 285 |
fn=process_microphone,
|
| 286 |
)
|
| 287 |
|
|
|
|
| 294 |
num_active_paths_slider,
|
| 295 |
uploaded_file,
|
| 296 |
],
|
| 297 |
+
outputs=[uploaded_html_info],
|
| 298 |
)
|
| 299 |
|
| 300 |
record_button.click(
|
|
|
|
| 306 |
num_active_paths_slider,
|
| 307 |
microphone,
|
| 308 |
],
|
| 309 |
+
outputs=[recorded_html_info],
|
| 310 |
)
|
| 311 |
gr.Markdown(description)
|
| 312 |
|