Spaces:
Running
Running
update
Browse files
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("
|
37 |
|
38 |
-
cmd = "build/
|
39 |
filename
|
40 |
)
|
41 |
-
|
42 |
|
43 |
pattern = "text: (.*)textSize: (.*)wordSize: (.*)timeCost: (.+)"
|
44 |
-
match = re.search(pattern,
|
45 |
|
46 |
if match is None:
|
47 |
-
raise AssertionError("run
|
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 = "##
|
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("
|
86 |
-
uploaded_output = gr.Textbox(label="
|
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,
|