HoneyTian commited on
Commit
45612e0
1 Parent(s): 99ec095
Files changed (2) hide show
  1. main.py +7 -1
  2. vad_go.go +7 -3
main.py CHANGED
@@ -30,7 +30,7 @@ def get_args():
30
  return args
31
 
32
 
33
- def process_uploaded_file(filename: str) -> str:
34
  filename = Path(filename).as_posix()
35
 
36
  main_logger.info("do vad: {}".format(filename))
@@ -74,6 +74,8 @@ def main():
74
  type="filepath",
75
  label="Upload from disk",
76
  )
 
 
77
  upload_button = gr.Button("Run VAD")
78
  uploaded_output = gr.Textbox(label="outputs")
79
 
@@ -81,6 +83,8 @@ def main():
81
  examples=examples,
82
  inputs=[
83
  uploaded_file,
 
 
84
  ],
85
  outputs=[
86
  uploaded_output
@@ -92,6 +96,8 @@ def main():
92
  process_uploaded_file,
93
  inputs=[
94
  uploaded_file,
 
 
95
  ],
96
  outputs=[
97
  uploaded_output
 
30
  return args
31
 
32
 
33
+ def process_uploaded_file(filename: str, silence_time: float = 0.3, longest_activate: float = 3.0) -> str:
34
  filename = Path(filename).as_posix()
35
 
36
  main_logger.info("do vad: {}".format(filename))
 
74
  type="filepath",
75
  label="Upload from disk",
76
  )
77
+ uploaded_silence_time = gr.Slider(minimum=0.0, maximum=1.0, value=0.3, step=0.01, label="silence time")
78
+ uploaded_longest_activate = gr.Slider(minimum=0.0, maximum=20.0, value=3.0, step=0.1, label="longest activate")
79
  upload_button = gr.Button("Run VAD")
80
  uploaded_output = gr.Textbox(label="outputs")
81
 
 
83
  examples=examples,
84
  inputs=[
85
  uploaded_file,
86
+ uploaded_silence_time,
87
+ uploaded_longest_activate,
88
  ],
89
  outputs=[
90
  uploaded_output
 
96
  process_uploaded_file,
97
  inputs=[
98
  uploaded_file,
99
+ uploaded_silence_time,
100
+ uploaded_longest_activate,
101
  ],
102
  outputs=[
103
  uploaded_output
vad_go.go CHANGED
@@ -8,10 +8,14 @@ import (
8
  )
9
 
10
  func main () {
11
- args := flag.String("filename", "", "input wav audio file")
 
 
12
  flag.Parse()
13
 
14
- var filename string = *args
 
 
15
  fmt.Println(filename)
16
 
17
  var wavInfo audio.WavInfoType
@@ -39,7 +43,7 @@ func main () {
39
  count := uint32(0)
40
 
41
  sv := streaming_vad.StreamingVadType{}
42
- sv.Init(8000, 0.4, 3.0)
43
 
44
  var begin uint32
45
  var end uint32
 
8
  )
9
 
10
  func main () {
11
+ filenamePtr := flag.String("filename", "", "input wav audio file")
12
+ silenceTimePtr := flag.Float32("silence_time", 0.0, "silence time in seconds")
13
+ longestActivatePtr := flag.Float32("longest_activate", 0.0, "longest activate time in seconds")
14
  flag.Parse()
15
 
16
+ var filename string = *filenamePtr
17
+ var silenceTime float32 = *silenceTimePtr
18
+ var longestActivate float32 = *longestActivatePtr
19
  fmt.Println(filename)
20
 
21
  var wavInfo audio.WavInfoType
 
43
  count := uint32(0)
44
 
45
  sv := streaming_vad.StreamingVadType{}
46
+ sv.Init(8000, silenceTime, longestActivate)
47
 
48
  var begin uint32
49
  var end uint32