Spaces:
Build error
Build error
File size: 1,338 Bytes
5009cb8 55e29e2 5009cb8 |
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 44 45 |
"""Speech synthesis service interface."""
from abc import ABC, abstractmethod
from typing import Iterator, TYPE_CHECKING
if TYPE_CHECKING:
from ..models.speech_synthesis_request import SpeechSynthesisRequest
from ..models.audio_content import AudioContent
from ..models.audio_chunk import AudioChunk
class ISpeechSynthesisService(ABC):
"""Interface for speech synthesis services."""
@abstractmethod
def synthesize(self, request: 'SpeechSynthesisRequest') -> 'AudioContent':
"""
Synthesize speech from text.
Args:
request: The speech synthesis request containing text and voice settings
Returns:
AudioContent: The synthesized audio
Raises:
SpeechSynthesisException: If synthesis fails
"""
pass
@abstractmethod
def synthesize_stream(self, request: 'SpeechSynthesisRequest') -> Iterator['AudioChunk']:
"""
Synthesize speech from text as a stream.
Args:
request: The speech synthesis request containing text and voice settings
Returns:
Iterator[AudioChunk]: Stream of audio chunks
Raises:
SpeechSynthesisException: If synthesis fails
"""
pass |