Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -49,7 +49,7 @@ article = """
|
|
49 |
"""
|
50 |
|
51 |
|
52 |
-
def infer(text, character, language
|
53 |
if language == '日本語':
|
54 |
pass
|
55 |
elif language == '简体中文':
|
@@ -62,7 +62,7 @@ def infer(text, character, language, duration, noise_scale, noise_scale_w):
|
|
62 |
x_tst = stn_tst.unsqueeze(0)
|
63 |
x_tst_lengths = torch.LongTensor([stn_tst.size(0)])
|
64 |
sid = torch.LongTensor([char_id])
|
65 |
-
audio = net_g.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=
|
66 |
return (text,(22050, audio))
|
67 |
|
68 |
# We instantiate the Textbox class
|
@@ -102,5 +102,5 @@ examples = [['お疲れ様です,トレーナーさん。', '1:无声铃鹿',
|
|
102 |
# noise_scale_slider = gr.Slider(minimum=0.1, maximum=5, value=0.667, step=0.001, label='噪声比例 noise_scale')
|
103 |
# noise_scale_w_slider = gr.Slider(minimum=0.1, maximum=5, value=0.8, step=0.1, label='噪声偏差 noise_scale_w')
|
104 |
|
105 |
-
gr.Interface(fn=infer, inputs=[textbox, char_dropdown, language_dropdown
|
106 |
title=title, description=description, article=article, examples=examples).launch()
|
|
|
49 |
"""
|
50 |
|
51 |
|
52 |
+
def infer(text, character, language):
|
53 |
if language == '日本語':
|
54 |
pass
|
55 |
elif language == '简体中文':
|
|
|
62 |
x_tst = stn_tst.unsqueeze(0)
|
63 |
x_tst_lengths = torch.LongTensor([stn_tst.size(0)])
|
64 |
sid = torch.LongTensor([char_id])
|
65 |
+
audio = net_g.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=0.667, noise_scale_w=0.8, length_scale=1)[0][0,0].data.cpu().float().numpy()
|
66 |
return (text,(22050, audio))
|
67 |
|
68 |
# We instantiate the Textbox class
|
|
|
102 |
# noise_scale_slider = gr.Slider(minimum=0.1, maximum=5, value=0.667, step=0.001, label='噪声比例 noise_scale')
|
103 |
# noise_scale_w_slider = gr.Slider(minimum=0.1, maximum=5, value=0.8, step=0.1, label='噪声偏差 noise_scale_w')
|
104 |
|
105 |
+
gr.Interface(fn=infer, inputs=[textbox, char_dropdown, language_dropdown],
|
106 |
title=title, description=description, article=article, examples=examples).launch()
|