Spaces:
Paused
Paused
Update stt/stt_lifecycle_manager.py
Browse files- stt/stt_lifecycle_manager.py +1 -30
stt/stt_lifecycle_manager.py
CHANGED
|
@@ -89,7 +89,7 @@ class STTLifecycleManager:
|
|
| 89 |
# Build STT config
|
| 90 |
locale = config_data.get("locale", "tr")
|
| 91 |
stt_config = STTConfig(
|
| 92 |
-
language=
|
| 93 |
sample_rate=config_data.get("sample_rate", 16000),
|
| 94 |
encoding=config_data.get("encoding", "LINEAR16"),
|
| 95 |
enable_punctuation=config_data.get("enable_punctuation", True),
|
|
@@ -297,35 +297,6 @@ class STTLifecycleManager:
|
|
| 297 |
log_error(f"❌ Failed to create STT instance", error=str(e))
|
| 298 |
raise
|
| 299 |
|
| 300 |
-
def _get_language_code(self, locale: str) -> str:
|
| 301 |
-
"""Convert locale to STT language code"""
|
| 302 |
-
# Map common locales to STT language codes
|
| 303 |
-
locale_map = {
|
| 304 |
-
"tr": "tr-TR",
|
| 305 |
-
"en": "en-US",
|
| 306 |
-
"de": "de-DE",
|
| 307 |
-
"fr": "fr-FR",
|
| 308 |
-
"es": "es-ES",
|
| 309 |
-
"it": "it-IT",
|
| 310 |
-
"pt": "pt-BR",
|
| 311 |
-
"ru": "ru-RU",
|
| 312 |
-
"ja": "ja-JP",
|
| 313 |
-
"ko": "ko-KR",
|
| 314 |
-
"zh": "zh-CN",
|
| 315 |
-
"ar": "ar-SA"
|
| 316 |
-
}
|
| 317 |
-
|
| 318 |
-
# Check direct match
|
| 319 |
-
if locale in locale_map:
|
| 320 |
-
return locale_map[locale]
|
| 321 |
-
|
| 322 |
-
# Check if it's already a full code
|
| 323 |
-
if "-" in locale and len(locale) == 5:
|
| 324 |
-
return locale
|
| 325 |
-
|
| 326 |
-
# Default to locale-LOCALE format
|
| 327 |
-
return f"{locale}-{locale.upper()}"
|
| 328 |
-
|
| 329 |
def get_stats(self) -> Dict[str, Any]:
|
| 330 |
"""Get STT manager statistics"""
|
| 331 |
session_stats = {}
|
|
|
|
| 89 |
# Build STT config
|
| 90 |
locale = config_data.get("locale", "tr")
|
| 91 |
stt_config = STTConfig(
|
| 92 |
+
language=locale,
|
| 93 |
sample_rate=config_data.get("sample_rate", 16000),
|
| 94 |
encoding=config_data.get("encoding", "LINEAR16"),
|
| 95 |
enable_punctuation=config_data.get("enable_punctuation", True),
|
|
|
|
| 297 |
log_error(f"❌ Failed to create STT instance", error=str(e))
|
| 298 |
raise
|
| 299 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 300 |
def get_stats(self) -> Dict[str, Any]:
|
| 301 |
"""Get STT manager statistics"""
|
| 302 |
session_stats = {}
|