Spaces:
Runtime error
Runtime error
Update tts_engine.py
Browse files- tts_engine.py +3 -3
tts_engine.py
CHANGED
|
@@ -37,7 +37,7 @@ class TTSEngine:
|
|
| 37 |
lang_code = LANG_MAP.get(lang.lower(), "en")
|
| 38 |
|
| 39 |
if voice_clone and os.path.exists("my_voice.wav"):
|
| 40 |
-
# clone your own voice
|
| 41 |
self.tts.tts_to_file(
|
| 42 |
text=text,
|
| 43 |
file_path=out_file,
|
|
@@ -45,11 +45,11 @@ class TTSEngine:
|
|
| 45 |
language=lang_code
|
| 46 |
)
|
| 47 |
else:
|
| 48 |
-
# fallback to a
|
| 49 |
self.tts.tts_to_file(
|
| 50 |
text=text,
|
| 51 |
file_path=out_file,
|
| 52 |
-
|
| 53 |
language=lang_code
|
| 54 |
)
|
| 55 |
else:
|
|
|
|
| 37 |
lang_code = LANG_MAP.get(lang.lower(), "en")
|
| 38 |
|
| 39 |
if voice_clone and os.path.exists("my_voice.wav"):
|
| 40 |
+
# ✅ clone your own voice
|
| 41 |
self.tts.tts_to_file(
|
| 42 |
text=text,
|
| 43 |
file_path=out_file,
|
|
|
|
| 45 |
language=lang_code
|
| 46 |
)
|
| 47 |
else:
|
| 48 |
+
# ✅ fallback to a demo synthetic voice (pretrained speaker)
|
| 49 |
self.tts.tts_to_file(
|
| 50 |
text=text,
|
| 51 |
file_path=out_file,
|
| 52 |
+
speaker="female-en-5", # <-- safe default
|
| 53 |
language=lang_code
|
| 54 |
)
|
| 55 |
else:
|