Spaces:
Running
Running
Update app.py
Browse filestorch.serialization.add_safe_globals([XttsConfig, XttsAudioConfig])
app.py
CHANGED
@@ -9,6 +9,7 @@ from TTS.api import TTS
|
|
9 |
from TTS.utils.manage import ModelManager
|
10 |
# attempt to import torch.serilization to fix current runtime error
|
11 |
from TTS.tts.configs.xtts_config import XttsConfig
|
|
|
12 |
import torch.serialization
|
13 |
# torch.serialization.add_safe_globals([XttsConfig])
|
14 |
model_names = TTS().list_models()
|
@@ -19,10 +20,10 @@ model_name = "tts_models/multilingual/multi-dataset/xtts_v2" # move in v2, since
|
|
19 |
#m = ModelManager().download_model(model_name)
|
20 |
#print(m)
|
21 |
m = model_name
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
|
27 |
|
28 |
def predict(prompt, language, audio_file_pth, mic_file_path, use_mic, agree, request: gr.Request):
|
|
|
9 |
from TTS.utils.manage import ModelManager
|
10 |
# attempt to import torch.serilization to fix current runtime error
|
11 |
from TTS.tts.configs.xtts_config import XttsConfig
|
12 |
+
from TTS.tts.models.xtts import XttsAudioConfig
|
13 |
import torch.serialization
|
14 |
# torch.serialization.add_safe_globals([XttsConfig])
|
15 |
model_names = TTS().list_models()
|
|
|
20 |
#m = ModelManager().download_model(model_name)
|
21 |
#print(m)
|
22 |
m = model_name
|
23 |
+
torch.serialization.add_safe_globals([XttsConfig, XttsAudioConfig])
|
24 |
+
tts = TTS(model_name, gpu=False)
|
25 |
+
tts.to("cpu") # no GPU or Amd
|
26 |
+
#tts.to("cuda") # cuda only
|
27 |
|
28 |
|
29 |
def predict(prompt, language, audio_file_pth, mic_file_path, use_mic, agree, request: gr.Request):
|