Update xtts.py
Browse files
xtts.py
CHANGED
@@ -5,8 +5,7 @@ import traceback
|
|
5 |
from TTS.api import TTS
|
6 |
|
7 |
|
8 |
-
|
9 |
-
bLOCAL=True
|
10 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
11 |
tts=None
|
12 |
model=None
|
@@ -20,12 +19,11 @@ if not os.path.exists(sample_root):
|
|
20 |
default_sample=f'{os.path.dirname(os.path.abspath(__file__))}/sample.wav', f'{sample_root}/sample.pt'
|
21 |
ffmpeg=f'{os.path.dirname(os.path.abspath(__file__))}/ffmpeg'
|
22 |
|
23 |
-
if
|
|
|
|
|
24 |
def upload(file):
|
25 |
return file
|
26 |
-
else:
|
27 |
-
from qili import upload
|
28 |
-
|
29 |
|
30 |
def predict(text, sample=None, language="zh"):
|
31 |
get_tts()
|
@@ -159,7 +157,7 @@ def tts_play():
|
|
159 |
|
160 |
|
161 |
@app.route("/setup")
|
162 |
-
def get_tts():
|
163 |
global tts
|
164 |
global model
|
165 |
if tts is None:
|
|
|
5 |
from TTS.api import TTS
|
6 |
|
7 |
|
8 |
+
api=os.environ.get('api')
|
|
|
9 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
10 |
tts=None
|
11 |
model=None
|
|
|
19 |
default_sample=f'{os.path.dirname(os.path.abspath(__file__))}/sample.wav', f'{sample_root}/sample.pt'
|
20 |
ffmpeg=f'{os.path.dirname(os.path.abspath(__file__))}/ffmpeg'
|
21 |
|
22 |
+
if api:
|
23 |
+
from qili import upload
|
24 |
+
else:
|
25 |
def upload(file):
|
26 |
return file
|
|
|
|
|
|
|
27 |
|
28 |
def predict(text, sample=None, language="zh"):
|
29 |
get_tts()
|
|
|
157 |
|
158 |
|
159 |
@app.route("/setup")
|
160 |
+
def get_tts(bLOCAL=None):
|
161 |
global tts
|
162 |
global model
|
163 |
if tts is None:
|