Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -26,6 +26,9 @@ for name in list_repo_files(repo_id="balacoon/tts"):
|
|
26 |
local_dir=os.getcwd(),
|
27 |
)
|
28 |
|
|
|
|
|
|
|
29 |
def text_to_speech(text):
|
30 |
with tempfile.NamedTemporaryFile(delete=False, suffix='.wav') as temp_file:
|
31 |
if len(text) > 1024:
|
@@ -34,6 +37,7 @@ def text_to_speech(text):
|
|
34 |
else:
|
35 |
text_str = text
|
36 |
with locker:
|
|
|
37 |
samples = tts.synthesize(text_str, "92")
|
38 |
output_file = temp_file.name
|
39 |
with wave.open(f"{output_file}", "w") as fp:
|
|
|
26 |
local_dir=os.getcwd(),
|
27 |
)
|
28 |
|
29 |
+
|
30 |
+
tts = TTS(os.path.join(os.getcwd(), tts_model_str))
|
31 |
+
|
32 |
def text_to_speech(text):
|
33 |
with tempfile.NamedTemporaryFile(delete=False, suffix='.wav') as temp_file:
|
34 |
if len(text) > 1024:
|
|
|
37 |
else:
|
38 |
text_str = text
|
39 |
with locker:
|
40 |
+
global tts
|
41 |
samples = tts.synthesize(text_str, "92")
|
42 |
output_file = temp_file.name
|
43 |
with wave.open(f"{output_file}", "w") as fp:
|