mirror of
https://github.com/snakers4/silero-vad.git
synced 2026-02-05 18:09:22 +08:00
Update hubconf.py
This commit is contained in:
62
hubconf.py
62
hubconf.py
@@ -4,9 +4,6 @@ import json
|
|||||||
import os
|
import os
|
||||||
from utils_vad import (init_jit_model,
|
from utils_vad import (init_jit_model,
|
||||||
get_speech_timestamps,
|
get_speech_timestamps,
|
||||||
get_number_ts,
|
|
||||||
get_language,
|
|
||||||
get_language_and_group,
|
|
||||||
save_audio,
|
save_audio,
|
||||||
read_audio,
|
read_audio,
|
||||||
VADIterator,
|
VADIterator,
|
||||||
@@ -52,63 +49,4 @@ def silero_vad(onnx=False, force_onnx_cpu=False):
|
|||||||
|
|
||||||
return model, utils
|
return model, utils
|
||||||
|
|
||||||
|
|
||||||
def silero_number_detector(onnx=False, force_onnx_cpu=False):
|
|
||||||
"""Silero Number Detector
|
|
||||||
Returns a model with a set of utils
|
|
||||||
Please see https://github.com/snakers4/silero-vad for usage examples
|
|
||||||
"""
|
|
||||||
raise NotImplementedError('This model has been deprecated and is not supported anymore.')
|
|
||||||
if onnx:
|
|
||||||
url = 'https://models.silero.ai/vad_models/number_detector.onnx'
|
|
||||||
else:
|
|
||||||
url = 'https://models.silero.ai/vad_models/number_detector.jit'
|
|
||||||
model = Validator(url, force_onnx_cpu)
|
|
||||||
utils = (get_number_ts,
|
|
||||||
save_audio,
|
|
||||||
read_audio,
|
|
||||||
collect_chunks,
|
|
||||||
drop_chunks)
|
|
||||||
|
|
||||||
return model, utils
|
|
||||||
|
|
||||||
|
|
||||||
def silero_lang_detector(onnx=False, force_onnx_cpu=False):
|
|
||||||
"""Silero Language Classifier
|
|
||||||
Returns a model with a set of utils
|
|
||||||
Please see https://github.com/snakers4/silero-vad for usage examples
|
|
||||||
"""
|
|
||||||
raise NotImplementedError('This model has been deprecated and is not supported anymore.')
|
|
||||||
if onnx:
|
|
||||||
url = 'https://models.silero.ai/vad_models/number_detector.onnx'
|
|
||||||
else:
|
|
||||||
url = 'https://models.silero.ai/vad_models/number_detector.jit'
|
|
||||||
model = Validator(url, force_onnx_cpu)
|
|
||||||
utils = (get_language,
|
|
||||||
read_audio)
|
|
||||||
|
|
||||||
return model, utils
|
|
||||||
|
|
||||||
|
|
||||||
def silero_lang_detector_95(onnx=False, force_onnx_cpu=False):
|
|
||||||
"""Silero Language Classifier (95 languages)
|
|
||||||
Returns a model with a set of utils
|
|
||||||
Please see https://github.com/snakers4/silero-vad for usage examples
|
|
||||||
"""
|
|
||||||
raise NotImplementedError('This model has been deprecated and is not supported anymore.')
|
|
||||||
if onnx:
|
|
||||||
url = 'https://models.silero.ai/vad_models/lang_classifier_95.onnx'
|
|
||||||
else:
|
|
||||||
url = 'https://models.silero.ai/vad_models/lang_classifier_95.jit'
|
|
||||||
model = Validator(url, force_onnx_cpu)
|
|
||||||
|
|
||||||
model_dir = os.path.join(os.path.dirname(__file__), 'files')
|
|
||||||
with open(os.path.join(model_dir, 'lang_dict_95.json'), 'r') as f:
|
|
||||||
lang_dict = json.load(f)
|
|
||||||
|
|
||||||
with open(os.path.join(model_dir, 'lang_group_dict_95.json'), 'r') as f:
|
|
||||||
lang_group_dict = json.load(f)
|
|
||||||
|
|
||||||
utils = (get_language_and_group, read_audio)
|
|
||||||
|
|
||||||
return model, lang_dict, lang_group_dict, utils
|
return model, lang_dict, lang_group_dict, utils
|
||||||
|
|||||||
Reference in New Issue
Block a user