Update xtts.py
Browse files
xtts.py
CHANGED
@@ -10,14 +10,18 @@ logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(
|
|
10 |
tts=None
|
11 |
model=None
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
sample_root=f'{os.getcwd()}/samples'
|
16 |
if not os.path.exists(sample_root):
|
17 |
os.makedirs(sample_root)
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
default_sample=f'{
|
20 |
-
ffmpeg=f'{
|
21 |
|
22 |
if api:
|
23 |
from qili import upload
|
@@ -157,11 +161,10 @@ def tts_play():
|
|
157 |
|
158 |
|
159 |
@app.route("/setup")
|
160 |
-
def get_tts(
|
161 |
global tts
|
162 |
global model
|
163 |
if tts is None:
|
164 |
-
model_path=os.environ.get("MODEL_DIR")
|
165 |
config_path=f'{model_path}/config.json'
|
166 |
vocoder_config_path=f'{model_path}/vocab.json'
|
167 |
model_name="tts_models/multilingual/multi-dataset/xtts_v2"
|
|
|
10 |
tts=None
|
11 |
model=None
|
12 |
|
13 |
+
root=os.path.dirname(os.path.abspath(__file__))
|
14 |
+
sample_root=f'{root}/samples'
|
|
|
15 |
if not os.path.exists(sample_root):
|
16 |
os.makedirs(sample_root)
|
17 |
+
|
18 |
+
LIBROSA_CACHE_DIR=f'{root}/caches'
|
19 |
+
if not os.path.exists(LIBROSA_CACHE_DIR):
|
20 |
+
os.makedirs(LIBROSA_CACHE_DIR)
|
21 |
+
os.environ["LIBROSA_CACHE_DIR"]=LIBROSA_CACHE_DIR
|
22 |
|
23 |
+
default_sample=f'{root}/sample.wav', f'{sample_root}/sample.pt'
|
24 |
+
ffmpeg=f'{root}/ffmpeg'
|
25 |
|
26 |
if api:
|
27 |
from qili import upload
|
|
|
161 |
|
162 |
|
163 |
@app.route("/setup")
|
164 |
+
def get_tts(model_path=os.environ["MODEL_DIR"]):
|
165 |
global tts
|
166 |
global model
|
167 |
if tts is None:
|
|
|
168 |
config_path=f'{model_path}/config.json'
|
169 |
vocoder_config_path=f'{model_path}/vocab.json'
|
170 |
model_name="tts_models/multilingual/multi-dataset/xtts_v2"
|