csukuangfj commited on
Commit
7ccc2b6
1 Parent(s): 8ae810e

minor fixes

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -51,11 +51,11 @@ def build_html_output(s: str, style: str = "result_item_success"):
51
 
52
 
53
  def process_uploaded_file(
54
- in_filename: str,
55
  language: str,
56
  repo_id: str,
57
  decoding_method: str,
58
  num_active_paths: int,
 
59
  ):
60
  if in_filename is None or in_filename == "":
61
  return "", build_html_output(
@@ -79,11 +79,11 @@ def process_uploaded_file(
79
 
80
 
81
  def process_microphone(
82
- in_filename: str,
83
  language: str,
84
  repo_id: str,
85
  decoding_method: str,
86
  num_active_paths: int,
 
87
  ):
88
  if in_filename is None or in_filename == "":
89
  return "", build_html_output(
@@ -108,17 +108,17 @@ def process_microphone(
108
 
109
 
110
  def process(
111
- in_filename: str,
112
  language: str,
113
  repo_id: str,
114
  decoding_method: str,
115
  num_active_paths: int,
 
116
  ):
117
- logging.info(f"in_filename: {in_filename}")
118
  logging.info(f"language: {language}")
119
  logging.info(f"repo_id: {repo_id}")
120
  logging.info(f"decoding_method: {decoding_method}")
121
  logging.info(f"num_active_paths: {num_active_paths}")
 
122
 
123
  filename = convert_to_wav(in_filename)
124
 
@@ -212,11 +212,11 @@ demo = gr.Blocks(css=css)
212
 
213
  examples = [
214
  [
215
- "./test_wavs/wenetspeech/DEV_T0000000000.opus",
216
  "Chinese",
217
  "luomingshuang/icefall_asr_wenetspeech_pruned_transducer_stateless2",
218
  "greedy_search",
219
  4,
 
220
  ],
221
  ]
222
 
@@ -270,11 +270,11 @@ with demo:
270
  gr.Examples(
271
  examples=examples,
272
  inputs=[
273
- uploaded_file,
274
  language_radio,
275
  model_dropdown,
276
  decoding_method_radio,
277
  num_active_paths_slider,
 
278
  ],
279
  outputs=[uploaded_output, uploaded_html_info],
280
  fn=process_uploaded_file,
@@ -295,11 +295,11 @@ with demo:
295
  gr.Examples(
296
  examples=examples,
297
  inputs=[
298
- microphone,
299
  language_radio,
300
  model_dropdown,
301
  decoding_method_radio,
302
  num_active_paths_slider,
 
303
  ],
304
  outputs=[recorded_output, recorded_html_info],
305
  fn=process_microphone,
@@ -308,11 +308,11 @@ with demo:
308
  upload_button.click(
309
  process_uploaded_file,
310
  inputs=[
311
- uploaded_file,
312
  language_radio,
313
  model_dropdown,
314
  decoding_method_radio,
315
  num_active_paths_slider,
 
316
  ],
317
  outputs=[uploaded_output, uploaded_html_info],
318
  )
@@ -320,11 +320,11 @@ with demo:
320
  record_button.click(
321
  process_microphone,
322
  inputs=[
323
- microphone,
324
  language_radio,
325
  model_dropdown,
326
  decoding_method_radio,
327
  num_active_paths_slider,
 
328
  ],
329
  outputs=[recorded_output, recorded_html_info],
330
  )
 
51
 
52
 
53
  def process_uploaded_file(
 
54
  language: str,
55
  repo_id: str,
56
  decoding_method: str,
57
  num_active_paths: int,
58
+ in_filename: str,
59
  ):
60
  if in_filename is None or in_filename == "":
61
  return "", build_html_output(
 
79
 
80
 
81
  def process_microphone(
 
82
  language: str,
83
  repo_id: str,
84
  decoding_method: str,
85
  num_active_paths: int,
86
+ in_filename: str,
87
  ):
88
  if in_filename is None or in_filename == "":
89
  return "", build_html_output(
 
108
 
109
 
110
  def process(
 
111
  language: str,
112
  repo_id: str,
113
  decoding_method: str,
114
  num_active_paths: int,
115
+ in_filename: str,
116
  ):
 
117
  logging.info(f"language: {language}")
118
  logging.info(f"repo_id: {repo_id}")
119
  logging.info(f"decoding_method: {decoding_method}")
120
  logging.info(f"num_active_paths: {num_active_paths}")
121
+ logging.info(f"in_filename: {in_filename}")
122
 
123
  filename = convert_to_wav(in_filename)
124
 
 
212
 
213
  examples = [
214
  [
 
215
  "Chinese",
216
  "luomingshuang/icefall_asr_wenetspeech_pruned_transducer_stateless2",
217
  "greedy_search",
218
  4,
219
+ "./test_wavs/wenetspeech/DEV_T0000000000.opus",
220
  ],
221
  ]
222
 
 
270
  gr.Examples(
271
  examples=examples,
272
  inputs=[
 
273
  language_radio,
274
  model_dropdown,
275
  decoding_method_radio,
276
  num_active_paths_slider,
277
+ uploaded_file,
278
  ],
279
  outputs=[uploaded_output, uploaded_html_info],
280
  fn=process_uploaded_file,
 
295
  gr.Examples(
296
  examples=examples,
297
  inputs=[
 
298
  language_radio,
299
  model_dropdown,
300
  decoding_method_radio,
301
  num_active_paths_slider,
302
+ microphone,
303
  ],
304
  outputs=[recorded_output, recorded_html_info],
305
  fn=process_microphone,
 
308
  upload_button.click(
309
  process_uploaded_file,
310
  inputs=[
 
311
  language_radio,
312
  model_dropdown,
313
  decoding_method_radio,
314
  num_active_paths_slider,
315
+ uploaded_file,
316
  ],
317
  outputs=[uploaded_output, uploaded_html_info],
318
  )
 
320
  record_button.click(
321
  process_microphone,
322
  inputs=[
 
323
  language_radio,
324
  model_dropdown,
325
  decoding_method_radio,
326
  num_active_paths_slider,
327
+ microphone,
328
  ],
329
  outputs=[recorded_output, recorded_html_info],
330
  )