Spaces:
Building
Building
Delete tts_interface.py
Browse files- tts_interface.py +0 -47
tts_interface.py
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
"""
|
2 |
-
TTS Interface for Flare
|
3 |
-
"""
|
4 |
-
from abc import ABC, abstractmethod
|
5 |
-
from typing import Optional, Dict, Any, Set
|
6 |
-
from datetime import datetime
|
7 |
-
import sys
|
8 |
-
|
9 |
-
class TTSInterface(ABC):
|
10 |
-
"""Abstract base class for TTS providers"""
|
11 |
-
|
12 |
-
def __init__(self):
|
13 |
-
self.preprocessing_flags: Set[str] = set()
|
14 |
-
self.supports_ssml: bool = False
|
15 |
-
|
16 |
-
@abstractmethod
|
17 |
-
async def synthesize(self, text: str, voice_id: Optional[str] = None, **kwargs) -> bytes:
|
18 |
-
"""
|
19 |
-
Convert text to speech and return audio bytes
|
20 |
-
|
21 |
-
Args:
|
22 |
-
text: Text to convert to speech
|
23 |
-
voice_id: Optional voice ID specific to the provider
|
24 |
-
**kwargs: Additional provider-specific parameters
|
25 |
-
|
26 |
-
Returns:
|
27 |
-
Audio data as bytes (MP3 or WAV format)
|
28 |
-
"""
|
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_provider_name(self) -> str:
|
38 |
-
"""Get provider name for logging"""
|
39 |
-
pass
|
40 |
-
|
41 |
-
def get_preprocessing_flags(self) -> Set[str]:
|
42 |
-
"""Get preprocessing flags for this provider"""
|
43 |
-
return self.preprocessing_flags
|
44 |
-
|
45 |
-
def supports_ssml_format(self) -> bool:
|
46 |
-
"""Check if provider supports SSML"""
|
47 |
-
return self.supports_ssml
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|