Spaces:
Running
Running
Commit
·
6473463
1
Parent(s):
9ef73e2
add global keyword
Browse files
app.py
CHANGED
|
@@ -66,9 +66,11 @@ def main():
|
|
| 66 |
uses cached list of speakers for the given model name
|
| 67 |
or loads the addon and checks what are the speakers.
|
| 68 |
"""
|
|
|
|
| 69 |
if model_name_str in model_to_speakers:
|
| 70 |
speakers = model_to_speakers[model_name_str]
|
| 71 |
else:
|
|
|
|
| 72 |
# need to load this model to learn the list of speakers
|
| 73 |
model_path = os.path.join(model_repo_dir, model_name_str)
|
| 74 |
tts = TTS(model_path)
|
|
@@ -99,6 +101,7 @@ def main():
|
|
| 99 |
logging.info("text, model name or speaker are not provided")
|
| 100 |
return None
|
| 101 |
expected_model_path = os.path.join(model_repo_dir, model_name_str)
|
|
|
|
| 102 |
if expected_model_path != cur_model_path:
|
| 103 |
# reload model
|
| 104 |
tts = TTS(expected_model_path)
|
|
|
|
| 66 |
uses cached list of speakers for the given model name
|
| 67 |
or loads the addon and checks what are the speakers.
|
| 68 |
"""
|
| 69 |
+
global model_to_speakers
|
| 70 |
if model_name_str in model_to_speakers:
|
| 71 |
speakers = model_to_speakers[model_name_str]
|
| 72 |
else:
|
| 73 |
+
global tts, cur_model_path
|
| 74 |
# need to load this model to learn the list of speakers
|
| 75 |
model_path = os.path.join(model_repo_dir, model_name_str)
|
| 76 |
tts = TTS(model_path)
|
|
|
|
| 101 |
logging.info("text, model name or speaker are not provided")
|
| 102 |
return None
|
| 103 |
expected_model_path = os.path.join(model_repo_dir, model_name_str)
|
| 104 |
+
global tts, cur_model_path
|
| 105 |
if expected_model_path != cur_model_path:
|
| 106 |
# reload model
|
| 107 |
tts = TTS(expected_model_path)
|