Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,24 +15,38 @@ from huggingface_hub import hf_hub_download
|
|
| 15 |
# ------------------------
|
| 16 |
# Download model files from Hugging Face if not present
|
| 17 |
# ------------------------
|
| 18 |
-
MODEL_DIR = "
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
from TTS.tts.models.xtts import Xtts
|
| 24 |
from TTS.tts.configs.xtts_config import XttsConfig
|
| 25 |
|
| 26 |
# Load model
|
| 27 |
config = XttsConfig()
|
| 28 |
-
config.load_json(
|
| 29 |
|
| 30 |
model = Xtts.init_from_config(config)
|
| 31 |
model.load_checkpoint(
|
| 32 |
config,
|
| 33 |
-
checkpoint_dir=
|
| 34 |
use_deepspeed=False,
|
| 35 |
-
vocab_path=
|
| 36 |
)
|
| 37 |
model.to(device)
|
| 38 |
|
|
|
|
| 15 |
# ------------------------
|
| 16 |
# Download model files from Hugging Face if not present
|
| 17 |
# ------------------------
|
| 18 |
+
MODEL_DIR = "my_model"
|
| 19 |
+
config_path = hf_hub_download(
|
| 20 |
+
repo_id="MariaKaiser/EGTTS_finetuned",
|
| 21 |
+
filename="config.json",
|
| 22 |
+
cache_dir=MODEL_DIR
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
vocab_path = hf_hub_download(
|
| 26 |
+
repo_id="MariaKaiser/EGTTS_finetuned",
|
| 27 |
+
filename="vocab.json",
|
| 28 |
+
cache_dir=MODEL_DIR
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
model_path = hf_hub_download(
|
| 32 |
+
repo_id="MariaKaiser/EGTTS_finetuned",
|
| 33 |
+
filename="model.pth",
|
| 34 |
+
cache_dir=MODEL_DIR
|
| 35 |
+
)
|
| 36 |
|
| 37 |
from TTS.tts.models.xtts import Xtts
|
| 38 |
from TTS.tts.configs.xtts_config import XttsConfig
|
| 39 |
|
| 40 |
# Load model
|
| 41 |
config = XttsConfig()
|
| 42 |
+
config.load_json(config_path)
|
| 43 |
|
| 44 |
model = Xtts.init_from_config(config)
|
| 45 |
model.load_checkpoint(
|
| 46 |
config,
|
| 47 |
+
checkpoint_dir= os.path.dirname(model_path),
|
| 48 |
use_deepspeed=False,
|
| 49 |
+
vocab_path= vocab_path
|
| 50 |
)
|
| 51 |
model.to(device)
|
| 52 |
|