Spaces:
Running
Running
fix
Browse files- ragg/app.py +16 -2
ragg/app.py
CHANGED
|
@@ -81,12 +81,26 @@ def xtts_speak_to_file(
|
|
| 81 |
|
| 82 |
# if not hasattr(xtts_speak_to_file, "_model") or xtts_speak_to_file._model is None:
|
| 83 |
# xtts_speak_to_file._model = TTS("tts_models/multilingual/multi-dataset/xtts_v2", gpu=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
if not hasattr(xtts_speak_to_file, "_model") or xtts_speak_to_file._model is None:
|
| 85 |
import sys
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
xtts_speak_to_file._model = TTS(
|
| 88 |
-
"tts_models/multilingual/multi-dataset/xtts_v2",
|
| 89 |
gpu=False,
|
|
|
|
| 90 |
)
|
| 91 |
tts = xtts_speak_to_file._model
|
| 92 |
|
|
|
|
| 81 |
|
| 82 |
# if not hasattr(xtts_speak_to_file, "_model") or xtts_speak_to_file._model is None:
|
| 83 |
# xtts_speak_to_file._model = TTS("tts_models/multilingual/multi-dataset/xtts_v2", gpu=False)
|
| 84 |
+
# if not hasattr(xtts_speak_to_file, "_model") or xtts_speak_to_file._model is None:
|
| 85 |
+
# import sys
|
| 86 |
+
# sys.stdin = open(os.devnull) # prevent EOF crash (no terminal input)
|
| 87 |
+
# xtts_speak_to_file._model = TTS(
|
| 88 |
+
# "tts_models/multilingual/multi-dataset/xtts_v2",
|
| 89 |
+
# gpu=False,
|
| 90 |
+
# )
|
| 91 |
if not hasattr(xtts_speak_to_file, "_model") or xtts_speak_to_file._model is None:
|
| 92 |
import sys
|
| 93 |
+
import builtins
|
| 94 |
+
|
| 95 |
+
# Force stdin to null and override input() globally
|
| 96 |
+
sys.stdin = open(os.devnull)
|
| 97 |
+
builtins.input = lambda *a, **kw: "" # prevents EOF when the model asks for input
|
| 98 |
+
os.environ["COQUI_TOS_AGREED"] = "1" # XTTS sometimes asks this internally
|
| 99 |
+
|
| 100 |
xtts_speak_to_file._model = TTS(
|
| 101 |
+
model_name="tts_models/multilingual/multi-dataset/xtts_v2",
|
| 102 |
gpu=False,
|
| 103 |
+
progress_bar=False,
|
| 104 |
)
|
| 105 |
tts = xtts_speak_to_file._model
|
| 106 |
|