Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
5a5c0e1
1
Parent(s):
c4baee9
Add warmup process for VAD model initialization
Browse filesInitialize the VAD model with a warmup process using zeros to ensure proper functioning before processing actual audio data.
- webrtc_vad.py +3 -0
webrtc_vad.py
CHANGED
|
@@ -56,6 +56,9 @@ class RealtimeVAD:
|
|
| 56 |
self.sum_positive_s = 0.0
|
| 57 |
self.silence_start_s: float | None = None
|
| 58 |
|
|
|
|
|
|
|
|
|
|
| 59 |
def process(self, audio_data: np.ndarray):
|
| 60 |
if audio_data.ndim == 2:
|
| 61 |
# FastRTC style [channels, samples]
|
|
|
|
| 56 |
self.sum_positive_s = 0.0
|
| 57 |
self.silence_start_s: float | None = None
|
| 58 |
|
| 59 |
+
# Warmup
|
| 60 |
+
self.vad_model.process(np.zeros(hop_size, dtype=np.int16))
|
| 61 |
+
|
| 62 |
def process(self, audio_data: np.ndarray):
|
| 63 |
if audio_data.ndim == 2:
|
| 64 |
# FastRTC style [channels, samples]
|