Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,16 @@
|
|
1 |
import os
|
2 |
import torch
|
3 |
import gradio as gr
|
4 |
-
from TTS.tts.configs.xtts_config import XttsConfig
|
5 |
-
from TTS.tts.models.xtts import XttsAudioConfig
|
|
|
6 |
from TTS.api import TTS
|
7 |
|
8 |
# β
Accept Coqui License Automatically
|
9 |
os.environ["COQUI_TOS_AGREED"] = "1"
|
10 |
|
11 |
-
# β
|
12 |
-
torch.serialization.add_safe_globals([XttsConfig, XttsAudioConfig])
|
13 |
|
14 |
# β
Force full checkpoint loading
|
15 |
def safe_load_checkpoint(model_path):
|
@@ -20,6 +21,7 @@ model_name = "tts_models/multilingual/multi-dataset/xtts_v2"
|
|
20 |
tts = TTS(model_name=model_name).to("cpu") # β
Ensure CPU usage
|
21 |
|
22 |
|
|
|
23 |
def generate_cloned_voice(text, reference_audio, language):
|
24 |
output_path = "output.wav"
|
25 |
|
|
|
1 |
import os
|
2 |
import torch
|
3 |
import gradio as gr
|
4 |
+
from TTS.tts.configs.xtts_config import XttsConfig
|
5 |
+
from TTS.tts.models.xtts import XttsAudioConfig
|
6 |
+
from TTS.config.shared_configs import BaseDatasetConfig # β
Import missing class
|
7 |
from TTS.api import TTS
|
8 |
|
9 |
# β
Accept Coqui License Automatically
|
10 |
os.environ["COQUI_TOS_AGREED"] = "1"
|
11 |
|
12 |
+
# β
Allow missing classes for safe deserialization
|
13 |
+
torch.serialization.add_safe_globals([XttsConfig, XttsAudioConfig, BaseDatasetConfig])
|
14 |
|
15 |
# β
Force full checkpoint loading
|
16 |
def safe_load_checkpoint(model_path):
|
|
|
21 |
tts = TTS(model_name=model_name).to("cpu") # β
Ensure CPU usage
|
22 |
|
23 |
|
24 |
+
|
25 |
def generate_cloned_voice(text, reference_audio, language):
|
26 |
output_path = "output.wav"
|
27 |
|