Spaces:
Building
Building
Update stt/stt_google.py
Browse files- stt/stt_google.py +13 -5
stt/stt_google.py
CHANGED
@@ -343,19 +343,27 @@ class GoogleCloudSTT(STTInterface):
|
|
343 |
self.client = speech.SpeechClient()
|
344 |
log_info("β
Created new Google Speech client")
|
345 |
|
|
|
346 |
recognition_config = speech.RecognitionConfig(
|
347 |
-
encoding=
|
348 |
sample_rate_hertz=16000,
|
349 |
-
language_code=
|
350 |
enable_automatic_punctuation=True,
|
351 |
model="latest_long",
|
352 |
-
use_enhanced=True
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
)
|
354 |
|
|
|
355 |
self.streaming_config = speech.StreamingRecognitionConfig(
|
356 |
config=recognition_config,
|
357 |
-
interim_results=
|
358 |
-
single_utterance=
|
359 |
enable_voice_activity_events=True # β
VAD events enabled
|
360 |
)
|
361 |
|
|
|
343 |
self.client = speech.SpeechClient()
|
344 |
log_info("β
Created new Google Speech client")
|
345 |
|
346 |
+
# Create recognition config
|
347 |
recognition_config = speech.RecognitionConfig(
|
348 |
+
encoding=speech.RecognitionConfig.AudioEncoding.WEBM_OPUS,
|
349 |
sample_rate_hertz=16000,
|
350 |
+
language_code="tr-TR",
|
351 |
enable_automatic_punctuation=True,
|
352 |
model="latest_long",
|
353 |
+
use_enhanced=True,
|
354 |
+
max_alternatives=1,
|
355 |
+
metadata=speech.RecognitionMetadata(
|
356 |
+
interaction_type=speech.RecognitionMetadata.InteractionType.VOICE_SEARCH,
|
357 |
+
microphone_distance=speech.RecognitionMetadata.MicrophoneDistance.NEARFIELD,
|
358 |
+
recording_device_type=speech.RecognitionMetadata.RecordingDeviceType.PC,
|
359 |
+
)
|
360 |
)
|
361 |
|
362 |
+
# Create streaming config with VAD
|
363 |
self.streaming_config = speech.StreamingRecognitionConfig(
|
364 |
config=recognition_config,
|
365 |
+
interim_results=True,
|
366 |
+
single_utterance=False,
|
367 |
enable_voice_activity_events=True # β
VAD events enabled
|
368 |
)
|
369 |
|