MariaKaiser commited on
Commit
6788b90
·
verified ·
1 Parent(s): 905f6b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -12
app.py CHANGED
@@ -5,7 +5,7 @@ import torchaudio
5
  import os
6
 
7
 
8
- MODEL_DIR = "my_model"
9
  OUTPUT_DIR = "outputs"
10
  os.makedirs(OUTPUT_DIR, exist_ok=True)
11
 
@@ -15,17 +15,10 @@ from huggingface_hub import hf_hub_download
15
  # ------------------------
16
  # Download model files from Hugging Face if not present
17
  # ------------------------
18
- MODEL_REPO = "MariaKaiser/EGTTS_finetuned" # replace with your repo name
19
-
20
- if not os.path.exists(os.path.join(MODEL_DIR, "config.json")):
21
- os.makedirs(MODEL_DIR, exist_ok=True)
22
- config_file = hf_hub_download(repo_id=MODEL_REPO, filename="config.json", cache_dir=MODEL_DIR)
23
- vocab_file = hf_hub_download(repo_id=MODEL_REPO, filename="vocab.json", cache_dir=MODEL_DIR)
24
- model_file = hf_hub_download(repo_id=MODEL_REPO, filename="model.pth", cache_dir=MODEL_DIR)
25
- else:
26
- config_file = os.path.join(MODEL_DIR, "config.json")
27
- vocab_file = os.path.join(MODEL_DIR, "vocab.json")
28
- model_file = os.path.join(MODEL_DIR, "model.pth")
29
 
30
  from TTS.tts.models.xtts import Xtts
31
  from TTS.tts.configs.xtts_config import XttsConfig
 
5
  import os
6
 
7
 
8
+ # MODEL_DIR = "my_model"
9
  OUTPUT_DIR = "outputs"
10
  os.makedirs(OUTPUT_DIR, exist_ok=True)
11
 
 
15
  # ------------------------
16
  # Download model files from Hugging Face if not present
17
  # ------------------------
18
+ MODEL_DIR = "/tmp/my_model"
19
+ os.makedirs(MODEL_DIR, exist_ok=True)
20
+ for fname in ["config.json", "vocab.json", "model.pth"]:
21
+ hf_hub_download("MariaKaiser/EGTTS_finetuned", filename=fname, cache_dir=MODEL_DIR)
 
 
 
 
 
 
 
22
 
23
  from TTS.tts.models.xtts import Xtts
24
  from TTS.tts.configs.xtts_config import XttsConfig