Spaces:
Sleeping
Sleeping
update
Browse files
main.py
CHANGED
@@ -54,7 +54,7 @@ def run_nx_vad(filename: str, silence_time: float = 0.3, longest_activate: float
|
|
54 |
pattern = "(\\d+)[\r\n]VadFlagPrepare[\r\n](?:\\d+)[\r\n]VadFlagSpeaking(?:[\r\n](?:\\d+)[\r\n]VadFlagPause[\r\n](?:\\d+)[\r\n]VadFlagSpeaking)?[\r\n](\\d+)[\r\n]VadFlagNoSpeech"
|
55 |
|
56 |
vad_timestamps = re.findall(pattern, raw_vad_result, flags=re.DOTALL)
|
57 |
-
vad_timestamps = [(
|
58 |
|
59 |
vad_timestamps: str = json.dumps(vad_timestamps, ensure_ascii=False, indent=2)
|
60 |
|
@@ -74,7 +74,7 @@ def run_silero_vad(filename: str, silence_time: float = 0.3, longest_activate: f
|
|
74 |
pattern = "speech starts at (.+?)s[\r\n].*?speech ends at (.+?)s"
|
75 |
|
76 |
vad_timestamps = re.findall(pattern, raw_vad_result, flags=re.DOTALL)
|
77 |
-
vad_timestamps = [(float(start), float(end)) for start, end in vad_timestamps]
|
78 |
|
79 |
vad_timestamps: str = json.dumps(vad_timestamps, ensure_ascii=False, indent=2)
|
80 |
|
|
|
54 |
pattern = "(\\d+)[\r\n]VadFlagPrepare[\r\n](?:\\d+)[\r\n]VadFlagSpeaking(?:[\r\n](?:\\d+)[\r\n]VadFlagPause[\r\n](?:\\d+)[\r\n]VadFlagSpeaking)?[\r\n](\\d+)[\r\n]VadFlagNoSpeech"
|
55 |
|
56 |
vad_timestamps = re.findall(pattern, raw_vad_result, flags=re.DOTALL)
|
57 |
+
vad_timestamps = [(int(start), int(end)) for start, end in vad_timestamps]
|
58 |
|
59 |
vad_timestamps: str = json.dumps(vad_timestamps, ensure_ascii=False, indent=2)
|
60 |
|
|
|
74 |
pattern = "speech starts at (.+?)s[\r\n].*?speech ends at (.+?)s"
|
75 |
|
76 |
vad_timestamps = re.findall(pattern, raw_vad_result, flags=re.DOTALL)
|
77 |
+
vad_timestamps = [(int(float(start) * 1000), float(end) * 1000) for start, end in vad_timestamps]
|
78 |
|
79 |
vad_timestamps: str = json.dumps(vad_timestamps, ensure_ascii=False, indent=2)
|
80 |
|