add configurable provider in settings.py and update ElevenLabs Api (#2065) (#2074)

This commit is contained in:
Nihar
2025-10-22 21:37:21 +05:30
committed by GitHub
parent c4e8daf50e
commit f448e4a615
7 changed files with 112 additions and 12 deletions

View File

@@ -0,0 +1,18 @@
from application.tts.google_tts import GoogleTTS
from application.tts.elevenlabs import ElevenlabsTTS
from application.tts.base import BaseTTS
class TTSCreator:
tts_providers = {
"google_tts": GoogleTTS,
"elevenlabs": ElevenlabsTTS,
}
@classmethod
def create_tts(cls, tts_type, *args, **kwargs)-> BaseTTS:
tts_class = cls.tts_providers.get(tts_type.lower())
if not tts_class:
raise ValueError(f"No tts class found for type {tts_type}")
return tts_class(*args, **kwargs)