Spaces:
Paused
Paused
| """ | |
| 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""" | |
| 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 |