Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,29 @@
|
|
1 |
import os
|
2 |
import torch
|
3 |
import gradio as gr
|
4 |
-
from TTS.tts.
|
5 |
-
from TTS.tts.models.xtts import XttsAudioConfig, XttsArgs
|
6 |
-
# β
Import missing class
|
7 |
from TTS.api import TTS
|
8 |
|
|
|
9 |
# β
Accept Coqui License Automatically
|
10 |
os.environ["COQUI_TOS_AGREED"] = "1"
|
11 |
|
12 |
-
|
13 |
-
torch.serialization.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
torch.serialization.safe_globals([XttsArgs])
|
15 |
|
16 |
# β
Force full checkpoint loading
|
|
|
1 |
import os
|
2 |
import torch
|
3 |
import gradio as gr
|
4 |
+
from TTS.tts.models.xtts import XttsArgs # β
Import required class
|
|
|
|
|
5 |
from TTS.api import TTS
|
6 |
|
7 |
+
|
8 |
# β
Accept Coqui License Automatically
|
9 |
os.environ["COQUI_TOS_AGREED"] = "1"
|
10 |
|
11 |
+
|
12 |
+
torch.serialization.safe_globals([XttsArgs])
|
13 |
+
|
14 |
+
# β
Force full checkpoint loading
|
15 |
+
def safe_load_checkpoint(model_path):
|
16 |
+
return torch.load(model_path, map_location="cpu", weights_only=False) # β
Force full deserialization
|
17 |
+
|
18 |
+
# β
Initialize TTS model
|
19 |
+
model_name = "tts_models/multilingual/multi-dataset/xtts_v2"
|
20 |
+
tts = TTS(model_name=model_name).to("cpu") # β
Ensure CPU usage
|
21 |
+
|
22 |
+
|
23 |
+
# β
Accept Coqui License Automatically
|
24 |
+
os.environ["COQUI_TOS_AGREED"] = "1"
|
25 |
+
|
26 |
+
|
27 |
torch.serialization.safe_globals([XttsArgs])
|
28 |
|
29 |
# β
Force full checkpoint loading
|