HoneyTian commited on
Commit
2b1261c
1 Parent(s): 382cf0c
Files changed (1) hide show
  1. main.py +8 -8
main.py CHANGED
@@ -33,18 +33,18 @@ def get_args():
33
  def process_uploaded_file(filename: str) -> str:
34
  filename = Path(filename).as_posix()
35
 
36
- main_logger.info("asr recognize: {}".format(filename))
37
 
38
- cmd = "build/asr_id --filename {}".format(
39
  filename
40
  )
41
- asr_result = Command.popen(cmd)
42
 
43
  pattern = "text: (.*)textSize: (.*)wordSize: (.*)timeCost: (.+)"
44
- match = re.search(pattern, asr_result, flags=re.IGNORECASE | re.DOTALL)
45
 
46
  if match is None:
47
- raise AssertionError("run asr recognize failed: \n{}".format(asr_result))
48
 
49
  text = match.group(1)
50
 
@@ -58,7 +58,7 @@ def shell(cmd: str):
58
  def main():
59
  args = get_args()
60
 
61
- title = "## 针对电话场景的印尼语ASR."
62
 
63
  # examples
64
  example_wav_dir = Path(args.example_wav_dir)
@@ -82,8 +82,8 @@ def main():
82
  type="filepath",
83
  label="Upload from disk",
84
  )
85
- upload_button = gr.Button("Submit for recognition")
86
- uploaded_output = gr.Textbox(label="Recognized speech from uploaded file")
87
 
88
  gr.Examples(
89
  examples=examples,
 
33
  def process_uploaded_file(filename: str) -> str:
34
  filename = Path(filename).as_posix()
35
 
36
+ main_logger.info("do vad: {}".format(filename))
37
 
38
+ cmd = "build/vad_go --filename {}".format(
39
  filename
40
  )
41
+ vad_result = Command.popen(cmd)
42
 
43
  pattern = "text: (.*)textSize: (.*)wordSize: (.*)timeCost: (.+)"
44
+ match = re.search(pattern, vad_result, flags=re.IGNORECASE | re.DOTALL)
45
 
46
  if match is None:
47
+ raise AssertionError("run vad failed: \n{}".format(vad_result))
48
 
49
  text = match.group(1)
50
 
 
58
  def main():
59
  args = get_args()
60
 
61
+ title = "## GO语言实现的VAD."
62
 
63
  # examples
64
  example_wav_dir = Path(args.example_wav_dir)
 
82
  type="filepath",
83
  label="Upload from disk",
84
  )
85
+ upload_button = gr.Button("Run VAD")
86
+ uploaded_output = gr.Textbox(label="outputs")
87
 
88
  gr.Examples(
89
  examples=examples,