File size: 1,563 Bytes
a847f43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
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