diff --git a/daras_ai_v2/text_to_speech_settings_widgets.py b/daras_ai_v2/text_to_speech_settings_widgets.py index 50dc50b46..2fb29eba0 100644 --- a/daras_ai_v2/text_to_speech_settings_widgets.py +++ b/daras_ai_v2/text_to_speech_settings_widgets.py @@ -7,6 +7,7 @@ import gooey_ui as st from daras_ai_v2 import settings +from daras_ai_v2.custom_enum import GooeyEnum from daras_ai_v2.enum_selector_widget import enum_selector from daras_ai_v2.exceptions import raise_for_status from daras_ai_v2.redis_cache import redis_cache_decorator @@ -28,15 +29,12 @@ } -class OpenAI_TTS_Models(str, Enum): +class OpenAI_TTS_Models(GooeyEnum): tts_1 = "tts-1" tts_1_hd = "tts-1-hd" -OPENAI_TTS_MODELS_T = typing.Literal[tuple(e.name for e in OpenAI_TTS_Models)] - - -class OpenAI_TTS_Voices(str, Enum): +class OpenAI_TTS_Voices(GooeyEnum): alloy = "alloy" echo = "echo" fable = "fable" @@ -45,9 +43,6 @@ class OpenAI_TTS_Voices(str, Enum): shimmer = "shimmer" -OPENAI_TTS_VOICES_T = typing.Literal[tuple(e.name for e in OpenAI_TTS_Voices)] - - class TextToSpeechProviders(Enum): GOOGLE_TTS = "Google Text-to-Speech" ELEVEN_LABS = "Eleven Labs" diff --git a/recipes/TextToSpeech.py b/recipes/TextToSpeech.py index 9d5e1eebf..f1e5449ce 100644 --- a/recipes/TextToSpeech.py +++ b/recipes/TextToSpeech.py @@ -21,8 +21,6 @@ TextToSpeechProviders, text_to_speech_provider_selector, azure_tts_voices, - OPENAI_TTS_MODELS_T, - OPENAI_TTS_VOICES_T, OpenAI_TTS_Models, OpenAI_TTS_Voices, OLD_ELEVEN_LABS_VOICES, @@ -56,8 +54,8 @@ class TextToSpeechSettings(BaseModel): azure_voice_name: str | None - openai_voice_name: OPENAI_TTS_VOICES_T | None - openai_tts_model: OPENAI_TTS_MODELS_T | None + openai_voice_name: OpenAI_TTS_Voices.api_choices | None + openai_tts_model: OpenAI_TTS_Models.api_choices | None class TextToSpeechPage(BasePage): @@ -81,8 +79,6 @@ class TextToSpeechPage(BasePage): "elevenlabs_model": "eleven_multilingual_v2", "elevenlabs_stability": 0.5, "elevenlabs_similarity_boost": 0.75, - "openai_voice_name": "alloy", - "openai_tts_model": "tts-1", } class RequestModelBase(BasePage.RequestModel):