Spaces:
Building
Building
Update stt/stt_google.py
Browse files- stt/stt_google.py +8 -22
stt/stt_google.py
CHANGED
@@ -329,7 +329,7 @@ class GoogleCloudSTT(STTInterface):
|
|
329 |
# Session verilerini resetle ve ID'yi artır
|
330 |
self._reset_session()
|
331 |
|
332 |
-
self.single_utterance = config.
|
333 |
|
334 |
log_info(f"🎤 Starting Google STT streaming session #{self.session_id} with config: {config}")
|
335 |
|
@@ -342,25 +342,12 @@ class GoogleCloudSTT(STTInterface):
|
|
342 |
# Yeni client oluştur (TEK SEFER)
|
343 |
self.client = speech.SpeechClient()
|
344 |
log_info("✅ Created new Google Speech client")
|
345 |
-
|
346 |
-
# Convert dict to STTConfig if needed
|
347 |
-
if isinstance(config, dict):
|
348 |
-
stt_config = STTConfig(
|
349 |
-
language=config.get("language", "tr-TR"),
|
350 |
-
sample_rate=config.get("sample_rate", 16000),
|
351 |
-
encoding=config.get("encoding", "WEBM_OPUS"),
|
352 |
-
enable_punctuation=config.get("enable_punctuation", True),
|
353 |
-
interim_results=config.get("interim_results", False),
|
354 |
-
single_utterance=self.single_utterance
|
355 |
-
)
|
356 |
-
else:
|
357 |
-
stt_config = config
|
358 |
-
|
359 |
recognition_config = speech.RecognitionConfig(
|
360 |
-
encoding=self._get_encoding(
|
361 |
-
sample_rate_hertz=
|
362 |
-
language_code=
|
363 |
-
enable_automatic_punctuation=
|
364 |
model=config.model,
|
365 |
use_enhanced=config.use_enhanced,
|
366 |
max_alternatives=1,
|
@@ -381,9 +368,8 @@ class GoogleCloudSTT(STTInterface):
|
|
381 |
|
382 |
self.streaming_config = speech.StreamingRecognitionConfig(
|
383 |
config=recognition_config,
|
384 |
-
interim_results=
|
385 |
-
single_utterance=
|
386 |
-
# enable_voice_activity_events kaldırıldı
|
387 |
)
|
388 |
|
389 |
self.is_streaming = True
|
|
|
329 |
# Session verilerini resetle ve ID'yi artır
|
330 |
self._reset_session()
|
331 |
|
332 |
+
self.single_utterance = config.single_utterance
|
333 |
|
334 |
log_info(f"🎤 Starting Google STT streaming session #{self.session_id} with config: {config}")
|
335 |
|
|
|
342 |
# Yeni client oluştur (TEK SEFER)
|
343 |
self.client = speech.SpeechClient()
|
344 |
log_info("✅ Created new Google Speech client")
|
345 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
recognition_config = speech.RecognitionConfig(
|
347 |
+
encoding=self._get_encoding(config.encoding),
|
348 |
+
sample_rate_hertz=config.sample_rate,
|
349 |
+
language_code=config.language,
|
350 |
+
enable_automatic_punctuation=config.enable_punctuation,
|
351 |
model=config.model,
|
352 |
use_enhanced=config.use_enhanced,
|
353 |
max_alternatives=1,
|
|
|
368 |
|
369 |
self.streaming_config = speech.StreamingRecognitionConfig(
|
370 |
config=recognition_config,
|
371 |
+
interim_results=config.interim_results,
|
372 |
+
single_utterance=config.single_utterance
|
|
|
373 |
)
|
374 |
|
375 |
self.is_streaming = True
|