diff --git a/ayushma/models/enums.py b/ayushma/models/enums.py index 66c1e22..a7a7c9c 100644 --- a/ayushma/models/enums.py +++ b/ayushma/models/enums.py @@ -20,8 +20,8 @@ class STTEngine(IntegerChoices): class TTSEngine(IntegerChoices): - OPENAI = 1 - GOOGLE = 2 + OPENAI = (1, "openai") + GOOGLE = (2, "google") class FeedBackRating(IntegerChoices): diff --git a/ayushma/utils/language_helpers.py b/ayushma/utils/language_helpers.py index 886387a..35b5cfd 100644 --- a/ayushma/utils/language_helpers.py +++ b/ayushma/utils/language_helpers.py @@ -47,7 +47,7 @@ def text_to_speech(text, language_code, service): text = sanitize_text(text) - if service == "google": + if service == TTSEngine.GOOGLE: client = texttospeech.TextToSpeechClient() synthesis_input = texttospeech.SynthesisInput(text=text) @@ -66,7 +66,7 @@ def text_to_speech(text, language_code, service): ) return response.audio_content - elif service == "openai": + elif service == TTSEngine.OPENAI: client = OpenAI(api_key=settings.OPENAI_API_KEY) response = client.audio.speech.create( model="tts-1-hd",