Skip to content

Instantly share code, notes, and snippets.

@snakers4
Created January 14, 2021 07:12
Show Gist options
  • Save snakers4/7fff3bdc2c4b7a11516df8af0402d6fd to your computer and use it in GitHub Desktop.
Save snakers4/7fff3bdc2c4b7a11516df8af0402d6fd to your computer and use it in GitHub Desktop.
silero_vad_example
import torch
torch.set_num_threads(1)
from pprint import pprint
model, utils = torch.hub.load(repo_or_dir='snakers4/silero-vad',
model='silero_vad',
force_reload=True)
(get_speech_ts,
_, read_audio,
_, _, _) = utils
files_dir = torch.hub.get_dir() + '/snakers4_silero-vad_master/files'
wav = read_audio(f'{files_dir}/en.wav')
# full audio
# get speech timestamps from full audio file
speech_timestamps = get_speech_ts(wav, model,
num_steps=4)
pprint(speech_timestamps)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment