Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,40 +1,25 @@
|
|
1 |
import os
|
2 |
import torch
|
3 |
import gradio as gr
|
4 |
-
from TTS.tts.models.xtts import XttsArgs
|
5 |
-
|
6 |
from TTS.api import TTS
|
7 |
|
8 |
-
|
9 |
# β
Accept Coqui License Automatically
|
10 |
os.environ["COQUI_TOS_AGREED"] = "1"
|
11 |
|
|
|
|
|
12 |
|
13 |
-
|
14 |
-
torch.serialization.add_safe_globals([XttsConfig])
|
15 |
-
|
16 |
-
# β
Force full checkpoint loading
|
17 |
-
def safe_load_checkpoint(model_path):
|
18 |
-
return torch.load(model_path, map_location="cpu", weights_only=False) # β
Force full deserialization
|
19 |
-
|
20 |
-
# β
Initialize TTS model
|
21 |
model_name = "tts_models/multilingual/multi-dataset/xtts_v2"
|
22 |
-
|
|
|
|
|
23 |
|
24 |
|
25 |
-
# β
Accept Coqui License Automatically
|
26 |
-
os.environ["COQUI_TOS_AGREED"] = "1"
|
27 |
|
28 |
|
29 |
-
torch.serialization.safe_globals([XttsArgs])
|
30 |
|
31 |
-
# β
Force full checkpoint loading
|
32 |
-
def safe_load_checkpoint(model_path):
|
33 |
-
return torch.load(model_path, map_location="cpu", weights_only=False) # β
Force full deserialization
|
34 |
|
35 |
-
# β
Initialize TTS model
|
36 |
-
model_name = "tts_models/multilingual/multi-dataset/xtts_v2"
|
37 |
-
tts = TTS(model_name=model_name).to("cpu") # β
Ensure CPU usage
|
38 |
|
39 |
|
40 |
|
|
|
1 |
import os
|
2 |
import torch
|
3 |
import gradio as gr
|
|
|
|
|
4 |
from TTS.api import TTS
|
5 |
|
|
|
6 |
# β
Accept Coqui License Automatically
|
7 |
os.environ["COQUI_TOS_AGREED"] = "1"
|
8 |
|
9 |
+
# β
Ensure CPU-only execution (disable GPU)
|
10 |
+
device = "cpu"
|
11 |
|
12 |
+
# β
Manually Load XTTS Model (Without `XttsConfig`)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
model_name = "tts_models/multilingual/multi-dataset/xtts_v2"
|
14 |
+
model_path = f"{os.getenv('HOME')}/.local/share/tts/{model_name.replace('/', '--')}" # Custom model path
|
15 |
+
|
16 |
+
tts = TTS(model_name=model_name).to(device)
|
17 |
|
18 |
|
|
|
|
|
19 |
|
20 |
|
|
|
21 |
|
|
|
|
|
|
|
22 |
|
|
|
|
|
|
|
23 |
|
24 |
|
25 |
|