独立依赖

This commit is contained in:
xsl
2026-04-08 14:38:04 +08:00
parent 760cf864eb
commit 64c894b673
36 changed files with 431 additions and 337 deletions
+9 -2
View File
@@ -2,6 +2,8 @@ from __future__ import annotations
from typing import Optional
from config import vad_bundle_path
class VADService:
def __init__(self) -> None:
@@ -15,10 +17,15 @@ class VADService:
if self._ready or self._attempted:
return
self._attempted = True
path = vad_bundle_path().resolve()
if not path.is_file():
self._error = f"missing Silero VAD weights: {path}"
return
try:
from silero_vad import VADIterator, load_silero_vad
from silero_vad import VADIterator
from silero_vad.utils_vad import init_jit_model
self._model = load_silero_vad()
self._model = init_jit_model(str(path))
self._iterator = VADIterator(
self._model,
threshold=0.65,