Spaces:
Running
Running
Yurii Paniv
commited on
Commit
·
784546d
1
Parent(s):
f9c2d45
Enhance available voices check
Browse files- ukrainian_tts/tts.py +4 -3
ukrainian_tts/tts.py
CHANGED
@@ -60,9 +60,10 @@ class TTS:
|
|
60 |
else:
|
61 |
stress = False
|
62 |
if voice not in [option.value for option in Voices]:
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
66 |
|
67 |
text = preprocess_text(text)
|
68 |
text = sentence_to_stress(text, stress_with_model if stress else stress_dict)
|
|
|
60 |
else:
|
61 |
stress = False
|
62 |
if voice not in [option.value for option in Voices]:
|
63 |
+
if voice not in self.xvectors.keys():
|
64 |
+
raise ValueError(
|
65 |
+
f"Invalid value for voice selected! Please use one of the following values: {', '.join([option.value for option in Voices])}."
|
66 |
+
)
|
67 |
|
68 |
text = preprocess_text(text)
|
69 |
text = sentence_to_stress(text, stress_with_model if stress else stress_dict)
|