csukuangfj commited on
Commit
3c07f54
·
1 Parent(s): 4850190

small fixes

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -97,7 +97,7 @@ def process_url(
97
  )
98
  except Exception as e:
99
  MyPrint(str(e))
100
- return "", build_html_output(str(e), "result_item_error")
101
 
102
 
103
  def process_uploaded_file(
@@ -124,7 +124,7 @@ def process_uploaded_file(
124
  decoding_method=decoding_method,
125
  num_active_paths=num_active_paths,
126
  add_punct=add_punct,
127
- )
128
  except Exception as e:
129
  MyPrint(str(e))
130
  return "", build_html_output(str(e), "result_item_error")
@@ -155,7 +155,7 @@ def process_microphone(
155
  decoding_method=decoding_method,
156
  num_active_paths=num_active_paths,
157
  add_punct=add_punct,
158
- )
159
  except Exception as e:
160
  MyPrint(str(e))
161
  return "", build_html_output(str(e), "result_item_error")
@@ -233,7 +233,7 @@ def process(
233
  MyPrint(info)
234
  MyPrint(f"\nrepo_id: {repo_id}\nhyp: {text}")
235
 
236
- return text, build_html_output(info)
237
 
238
 
239
  title = "# Automatic Speech Recognition with Next-gen Kaldi"
@@ -394,6 +394,7 @@ with demo:
394
 
395
  url_button = gr.Button("Submit for recognition")
396
  url_output = gr.Textbox(label="Recognized speech from URL")
 
397
  url_html_info = gr.HTML(label="Info")
398
 
399
  upload_button.click(
@@ -432,7 +433,7 @@ with demo:
432
  punct_radio,
433
  url_textbox,
434
  ],
435
- outputs=[url_output, url_html_info],
436
  )
437
 
438
  gr.Markdown(description)
 
97
  )
98
  except Exception as e:
99
  MyPrint(str(e))
100
+ return "", build_html_output(str(e), "result_item_error"), ""
101
 
102
 
103
  def process_uploaded_file(
 
124
  decoding_method=decoding_method,
125
  num_active_paths=num_active_paths,
126
  add_punct=add_punct,
127
+ )[:-1]
128
  except Exception as e:
129
  MyPrint(str(e))
130
  return "", build_html_output(str(e), "result_item_error")
 
155
  decoding_method=decoding_method,
156
  num_active_paths=num_active_paths,
157
  add_punct=add_punct,
158
+ )[:-1]
159
  except Exception as e:
160
  MyPrint(str(e))
161
  return "", build_html_output(str(e), "result_item_error")
 
233
  MyPrint(info)
234
  MyPrint(f"\nrepo_id: {repo_id}\nhyp: {text}")
235
 
236
+ return text, build_html_output(info), filename
237
 
238
 
239
  title = "# Automatic Speech Recognition with Next-gen Kaldi"
 
394
 
395
  url_button = gr.Button("Submit for recognition")
396
  url_output = gr.Textbox(label="Recognized speech from URL")
397
+ output_audio = gr.Audio(label="Audio for the URL")
398
  url_html_info = gr.HTML(label="Info")
399
 
400
  upload_button.click(
 
433
  punct_radio,
434
  url_textbox,
435
  ],
436
+ outputs=[url_output, url_html_info, output_audio],
437
  )
438
 
439
  gr.Markdown(description)