Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ import soundfile as sf
|
|
12 |
from datetime import datetime
|
13 |
import pytz
|
14 |
|
15 |
-
|
16 |
net_g = None
|
17 |
models = {
|
18 |
"Mellowdear": "./MODELS/adorabledarling.pth",
|
@@ -71,11 +71,11 @@ def infer(text, sdp_ratio, noise_scale, noise_scale_w, length_scale, sid, model_
|
|
71 |
sf.write("tmp.wav", audio, 44100)
|
72 |
return audio
|
73 |
|
74 |
-
|
75 |
-
now = datetime.now(tz).strftime('%m%d%H%M%S')
|
76 |
|
77 |
def convert_wav_to_mp3(wav_file):
|
78 |
-
global
|
|
|
79 |
os.makedirs('out', exist_ok=True)
|
80 |
output_path_mp3 = os.path.join('out', f"{now}.mp3")
|
81 |
|
@@ -87,7 +87,8 @@ def convert_wav_to_mp3(wav_file):
|
|
87 |
return output_path_mp3
|
88 |
|
89 |
def tts_generator(text, sdp_ratio, noise_scale, noise_scale_w, length_scale, model):
|
90 |
-
global net_g,speakers,
|
|
|
91 |
model_path = models[model]
|
92 |
net_g, _, _, _ = utils.load_checkpoint(model_path, net_g, None, skip_optimizer=True)
|
93 |
print(now+text)
|
@@ -122,9 +123,8 @@ if __name__ == "__main__":
|
|
122 |
with gr.Column():
|
123 |
|
124 |
gr.Markdown('''
|
125 |
-
|
126 |
-
|
127 |
-
huggingface.co/spaces/Ailyth/Multi-voice-TTS/tree/main
|
128 |
''')
|
129 |
text = gr.TextArea(label="输入需要生成语音的文字", placeholder="输入文字",
|
130 |
value="在不在?能不能借给我三百块钱买可乐",
|
|
|
12 |
from datetime import datetime
|
13 |
import pytz
|
14 |
|
15 |
+
tz = pytz.timezone('Asia/Shanghai')
|
16 |
net_g = None
|
17 |
models = {
|
18 |
"Mellowdear": "./MODELS/adorabledarling.pth",
|
|
|
71 |
sf.write("tmp.wav", audio, 44100)
|
72 |
return audio
|
73 |
|
74 |
+
|
|
|
75 |
|
76 |
def convert_wav_to_mp3(wav_file):
|
77 |
+
global tz
|
78 |
+
now = datetime.now(tz).strftime('%m%d%H%M%S')
|
79 |
os.makedirs('out', exist_ok=True)
|
80 |
output_path_mp3 = os.path.join('out', f"{now}.mp3")
|
81 |
|
|
|
87 |
return output_path_mp3
|
88 |
|
89 |
def tts_generator(text, sdp_ratio, noise_scale, noise_scale_w, length_scale, model):
|
90 |
+
global net_g,speakers,tz
|
91 |
+
now = datetime.now(tz).strftime('%m-%d %H:%M:%S')
|
92 |
model_path = models[model]
|
93 |
net_g, _, _, _ = utils.load_checkpoint(model_path, net_g, None, skip_optimizer=True)
|
94 |
print(now+text)
|
|
|
123 |
with gr.Column():
|
124 |
|
125 |
gr.Markdown('''
|
126 |
+
**仅供测试用**
|
127 |
+
ce.co/spaces/Ailyth/Multi-voice-TTS/tree/main
|
|
|
128 |
''')
|
129 |
text = gr.TextArea(label="输入需要生成语音的文字", placeholder="输入文字",
|
130 |
value="在不在?能不能借给我三百块钱买可乐",
|