flare / stt_factory.py
ciyidogan's picture
Create stt_factory.py
a847f43 verified
raw
history blame
1.56 kB
"""
STT Factory for creating provider instances
"""
from typing import Optional, Dict, Any
from utils import log
from stt_interface import STTInterface, STTEngineType
from stt_google import GoogleCloudSTT
# Future imports:
# from stt_azure import AzureSpeechSTT
# from stt_amazon import AmazonTranscribeSTT
# from stt_flicker import FlickerSTT
class STTFactory:
"""Factory for creating STT provider instances"""
@staticmethod
def create(engine_type: STTEngineType, config: Dict[str, Any]) -> Optional[STTInterface]:
"""Create STT provider instance based on engine type"""
if engine_type == STTEngineType.NO_STT:
log("πŸ”‡ No STT engine configured")
return None
elif engine_type == STTEngineType.GOOGLE:
log("🎀 Creating Google Cloud STT provider")
return GoogleCloudSTT(config.get("credentials_path", ""))
elif engine_type == STTEngineType.AZURE:
log("🎀 Azure STT not implemented yet")
return None # TODO: Implement AzureSpeechSTT
elif engine_type == STTEngineType.AMAZON:
log("🎀 Amazon STT not implemented yet")
return None # TODO: Implement AmazonTranscribeSTT
elif engine_type == STTEngineType.FLICKER:
log("🎀 Flicker STT not implemented yet")
return None # TODO: Implement FlickerSTT
else:
log(f"❌ Unknown STT engine type: {engine_type}")
return None