From 4c0744921e4ea8fce51cedcf7c3d05aecd822b7d Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Sun, 11 Feb 2024 20:23:16 +0530 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Rithvik Nishad --- ayushma/models/enums.py | 4 ++-- ayushma/utils/language_helpers.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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",