Spaces:
Building
Building
Update stt_google.py
Browse files- stt_google.py +4 -2
stt_google.py
CHANGED
@@ -247,7 +247,6 @@ class GoogleCloudSTT(STTInterface):
|
|
247 |
log_error(f"❌ Google STT stream error: {error_msg}")
|
248 |
|
249 |
except Exception as e:
|
250 |
-
import traceback
|
251 |
log_error(f"❌ Fatal error in STT stream thread", error=str(e), traceback=traceback.format_exc())
|
252 |
finally:
|
253 |
log_info("🎤 Google STT stream thread ended")
|
@@ -257,6 +256,8 @@ class GoogleCloudSTT(STTInterface):
|
|
257 |
async def stream_audio(self, audio_chunk: bytes) -> AsyncIterator[TranscriptionResult]:
|
258 |
"""Stream audio chunk and get transcription results"""
|
259 |
if not self.is_streaming:
|
|
|
|
|
260 |
raise RuntimeError("Streaming not started. Call start_streaming() first.")
|
261 |
|
262 |
try:
|
@@ -268,7 +269,6 @@ class GoogleCloudSTT(STTInterface):
|
|
268 |
try:
|
269 |
# Non-blocking get from normal queue
|
270 |
result = self.responses_queue.get_nowait()
|
271 |
-
# Debug log'u kaldırdık
|
272 |
yield result
|
273 |
except queue.Empty:
|
274 |
# No more results in queue
|
@@ -276,6 +276,8 @@ class GoogleCloudSTT(STTInterface):
|
|
276 |
|
277 |
except Exception as e:
|
278 |
log_error(f"❌ Google STT streaming error", error=str(e))
|
|
|
|
|
279 |
raise
|
280 |
|
281 |
async def stop_streaming(self) -> Optional[TranscriptionResult]:
|
|
|
247 |
log_error(f"❌ Google STT stream error: {error_msg}")
|
248 |
|
249 |
except Exception as e:
|
|
|
250 |
log_error(f"❌ Fatal error in STT stream thread", error=str(e), traceback=traceback.format_exc())
|
251 |
finally:
|
252 |
log_info("🎤 Google STT stream thread ended")
|
|
|
256 |
async def stream_audio(self, audio_chunk: bytes) -> AsyncIterator[TranscriptionResult]:
|
257 |
"""Stream audio chunk and get transcription results"""
|
258 |
if not self.is_streaming:
|
259 |
+
# Daha detaylı hata mesajı
|
260 |
+
log_error(f"❌ STT not streaming - is_streaming: {self.is_streaming}, thread alive: {self.stream_thread and self.stream_thread.is_alive() if hasattr(self, 'stream_thread') else 'No thread'}")
|
261 |
raise RuntimeError("Streaming not started. Call start_streaming() first.")
|
262 |
|
263 |
try:
|
|
|
269 |
try:
|
270 |
# Non-blocking get from normal queue
|
271 |
result = self.responses_queue.get_nowait()
|
|
|
272 |
yield result
|
273 |
except queue.Empty:
|
274 |
# No more results in queue
|
|
|
276 |
|
277 |
except Exception as e:
|
278 |
log_error(f"❌ Google STT streaming error", error=str(e))
|
279 |
+
# Stream'i tekrar başlatmayı tetikle
|
280 |
+
self.is_streaming = False
|
281 |
raise
|
282 |
|
283 |
async def stop_streaming(self) -> Optional[TranscriptionResult]:
|