Skip to content

Commit 23eee89

Browse files
committed
bit more cleanup
1 parent 5b57a00 commit 23eee89

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

plugins/smart_turn/vision_agents/plugins/smart_turn/turn_detection_2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ async def start(self):
106106

107107
async def _prepare_smart_turn(self):
108108
await ensure_model(SMART_TURN_ONNX_PATH, SMART_TURN_ONNX_URL)
109+
self._whisper_extractor = WhisperFeatureExtractor(chunk_length=8)
109110
# Load ONNX session in thread pool to avoid blocking event loop
110111
self.smart_turn = await asyncio.to_thread(build_session, SMART_TURN_ONNX_PATH)
111112

@@ -118,7 +119,6 @@ async def _prepare_silero_vad(self):
118119
reset_interval_seconds=self.vad_reset_interval_seconds
119120
)
120121

121-
122122
async def process_audio(
123123
self,
124124
audio_data: PcmData,
@@ -174,14 +174,14 @@ async def _predict_turn_completed(self, pcm: PcmData, participant: Participant)
174174
pcm = pcm.resample(16000).to_float32()
175175

176176
#TODO: can we only init this once?
177-
feature_extractor = WhisperFeatureExtractor(chunk_length=8)
177+
178178

179179
audio_array = pcm.samples
180180
# Truncate to 8 seconds (keeping the end) or pad to 8 seconds
181181
audio_array = truncate_audio_to_last_n_seconds(audio_array, n_seconds=8)
182182

183183
# Process audio using Whisper's feature extractor
184-
inputs = feature_extractor(
184+
inputs = self._whisper_extractor(
185185
audio_array,
186186
sampling_rate=16000,
187187
return_tensors="np",

0 commit comments

Comments
 (0)