Update app.py
Browse files
app.py
CHANGED
|
@@ -18,7 +18,7 @@ model, utils = torch.hub.load(repo_or_dir='snakers4/silero-vad',
|
|
| 18 |
collect_chunks) = utils
|
| 19 |
|
| 20 |
|
| 21 |
-
def get_labels(audio_fp, threshold, min_speech_duration_ms, min_silence_duration_ms, auto_merge, uppper_merge_threshold,
|
| 22 |
wav, sr = torchaudio.load(audio_fp)
|
| 23 |
wav = torchaudio.functional.resample(wav, orig_freq=sr, new_freq=16000)
|
| 24 |
speech_timestamps = get_speech_timestamps(wav,
|
|
@@ -49,7 +49,7 @@ def get_labels(audio_fp, threshold, min_speech_duration_ms, min_silence_duration
|
|
| 49 |
new_labels = [list(labels[0])]
|
| 50 |
for i in range(1, len(labels)):
|
| 51 |
if (
|
| 52 |
-
gaps[i - 1] <=
|
| 53 |
and duration(new_labels[-1]) + gaps[i - 1] + duration(labels[i])
|
| 54 |
< max_segment_length
|
| 55 |
):
|
|
|
|
| 18 |
collect_chunks) = utils
|
| 19 |
|
| 20 |
|
| 21 |
+
def get_labels(audio_fp, threshold, min_speech_duration_ms, min_silence_duration_ms, auto_merge, uppper_merge_threshold, max_segment_length):
|
| 22 |
wav, sr = torchaudio.load(audio_fp)
|
| 23 |
wav = torchaudio.functional.resample(wav, orig_freq=sr, new_freq=16000)
|
| 24 |
speech_timestamps = get_speech_timestamps(wav,
|
|
|
|
| 49 |
new_labels = [list(labels[0])]
|
| 50 |
for i in range(1, len(labels)):
|
| 51 |
if (
|
| 52 |
+
gaps[i - 1] <= uppper_merge_threshold
|
| 53 |
and duration(new_labels[-1]) + gaps[i - 1] + duration(labels[i])
|
| 54 |
< max_segment_length
|
| 55 |
):
|