ciyidogan commited on
Commit
d6da344
·
verified ·
1 Parent(s): f119504

Update tts_interface.py

Browse files
Files changed (1) hide show
  1. tts_interface.py +14 -12
tts_interface.py CHANGED
@@ -19,26 +19,28 @@ def log(message: str):
19
  class TTSInterface(ABC):
20
  """Abstract base class for TTS providers"""
21
 
 
 
 
 
22
  @abstractmethod
23
  async def synthesize(self, text: str, voice_id: Optional[str] = None, **kwargs) -> bytes:
24
- """
25
- Convert text to speech and return audio bytes
26
-
27
- Args:
28
- text: Text to convert to speech
29
- voice_id: Optional voice ID specific to the provider
30
- **kwargs: Additional provider-specific parameters
31
-
32
- Returns:
33
- Audio data as bytes (MP3 or WAV format)
34
- """
35
  pass
36
 
37
  @abstractmethod
38
  def get_supported_voices(self) -> Dict[str, str]:
39
  """Get list of supported voices"""
40
  pass
41
-
 
 
 
 
 
 
 
 
42
 
43
  class ElevenLabsTTS(TTSInterface):
44
  """ElevenLabs TTS implementation"""
 
19
  class TTSInterface(ABC):
20
  """Abstract base class for TTS providers"""
21
 
22
+ def __init__(self):
23
+ self.preprocessing_flags: Set[str] = set()
24
+ self.supports_ssml: bool = False
25
+
26
  @abstractmethod
27
  async def synthesize(self, text: str, voice_id: Optional[str] = None, **kwargs) -> bytes:
28
+ """Convert text to speech and return audio bytes"""
 
 
 
 
 
 
 
 
 
 
29
  pass
30
 
31
  @abstractmethod
32
  def get_supported_voices(self) -> Dict[str, str]:
33
  """Get list of supported voices"""
34
  pass
35
+
36
+ @abstractmethod
37
+ def get_preprocessing_flags(self) -> Set[str]:
38
+ """Get preprocessing flags for this provider"""
39
+ pass
40
+
41
+ def supports_ssml(self) -> bool:
42
+ """Check if provider supports SSML"""
43
+ return self.supports_ssml
44
 
45
  class ElevenLabsTTS(TTSInterface):
46
  """ElevenLabs TTS implementation"""