mirror of
https://github.com/snakers4/silero-vad.git
synced 2026-02-05 18:09:22 +08:00
Add Number Detector + utils
This commit is contained in:
22
hubconf.py
22
hubconf.py
@@ -2,11 +2,13 @@ dependencies = ['torch', 'torchaudio']
|
||||
import torch
|
||||
from utils import (init_jit_model,
|
||||
get_speech_ts,
|
||||
get_number_ts,
|
||||
save_audio,
|
||||
read_audio,
|
||||
state_generator,
|
||||
single_audio_stream,
|
||||
collect_speeches)
|
||||
collect_chunks,
|
||||
drop_chunks)
|
||||
|
||||
|
||||
def silero_vad(**kwargs):
|
||||
@@ -21,6 +23,22 @@ def silero_vad(**kwargs):
|
||||
read_audio,
|
||||
state_generator,
|
||||
single_audio_stream,
|
||||
collect_speeches)
|
||||
collect_chunks)
|
||||
|
||||
return model, utils
|
||||
|
||||
|
||||
def silero_number_detector(**kwargs):
|
||||
"""Silero Number Detector and Language Classifier
|
||||
Returns a model with a set of utils
|
||||
Please see https://github.com/snakers4/silero-vad for usage examples
|
||||
"""
|
||||
hub_dir = torch.hub.get_dir()
|
||||
model = init_jit_model(model_path=f'{hub_dir}/snakers4_silero-vad_master/files/number_detector.jit')
|
||||
utils = (get_number_ts,
|
||||
save_audio,
|
||||
read_audio,
|
||||
collect_chunks,
|
||||
drop_chunks)
|
||||
|
||||
return model, utils
|
||||
|
||||
Reference in New Issue
Block a user