ciyidogan commited on
Commit
a847f43
Β·
verified Β·
1 Parent(s): 0da26ae

Create stt_factory.py

Browse files
Files changed (1) hide show
  1. stt_factory.py +43 -0
stt_factory.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ STT Factory for creating provider instances
3
+ """
4
+
5
+ from typing import Optional, Dict, Any
6
+ from utils import log
7
+ from stt_interface import STTInterface, STTEngineType
8
+ from stt_google import GoogleCloudSTT
9
+ # Future imports:
10
+ # from stt_azure import AzureSpeechSTT
11
+ # from stt_amazon import AmazonTranscribeSTT
12
+ # from stt_flicker import FlickerSTT
13
+
14
+ class STTFactory:
15
+ """Factory for creating STT provider instances"""
16
+
17
+ @staticmethod
18
+ def create(engine_type: STTEngineType, config: Dict[str, Any]) -> Optional[STTInterface]:
19
+ """Create STT provider instance based on engine type"""
20
+
21
+ if engine_type == STTEngineType.NO_STT:
22
+ log("πŸ”‡ No STT engine configured")
23
+ return None
24
+
25
+ elif engine_type == STTEngineType.GOOGLE:
26
+ log("🎀 Creating Google Cloud STT provider")
27
+ return GoogleCloudSTT(config.get("credentials_path", ""))
28
+
29
+ elif engine_type == STTEngineType.AZURE:
30
+ log("🎀 Azure STT not implemented yet")
31
+ return None # TODO: Implement AzureSpeechSTT
32
+
33
+ elif engine_type == STTEngineType.AMAZON:
34
+ log("🎀 Amazon STT not implemented yet")
35
+ return None # TODO: Implement AmazonTranscribeSTT
36
+
37
+ elif engine_type == STTEngineType.FLICKER:
38
+ log("🎀 Flicker STT not implemented yet")
39
+ return None # TODO: Implement FlickerSTT
40
+
41
+ else:
42
+ log(f"❌ Unknown STT engine type: {engine_type}")
43
+ return None