speech_service.py 528 B

1234567891011121314151617
  1. from ..schemas.llm import TextToSpeechRequest, TextToSpeechResponse
  2. from ..providers.speech_provider import SpeechProvider
  3. class SpeechService:
  4. def __init__(self, provider: SpeechProvider) -> None:
  5. self._provider = provider
  6. def text_to_speech(self, req: TextToSpeechRequest) -> TextToSpeechResponse:
  7. return self._provider.text_to_speech(
  8. req.pitch,
  9. req.rate,
  10. req.filename,
  11. req.text,
  12. model=req.model,
  13. format=req.format,
  14. )