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):
|
|
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
|
@@ -98,8 +98,8 @@ examples = [['お疲れ様です,トレーナーさん。', '1:无声铃鹿',
|
|
98 |
['お帰りなさい,お兄様!', '29:米浴','日本語'],
|
99 |
['私の処女をもらっでください!', '29:米浴','日本語']]
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
|
105 |
-
gr.Interface(fn=infer, inputs=[textbox, char_dropdown, language_dropdown], outputs=["text","audio"],
|
|
|
49 |
"""
|
50 |
|
51 |
|
52 |
+
def infer(text, character, language, duration, noise_scale, noise_scale_w):
|
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=noise_scale, noise_scale_w=noise_scale_w, length_scale=duration)[0][0,0].data.cpu().float().numpy()
|
66 |
return (text,(22050, audio))
|
67 |
|
68 |
# We instantiate the Textbox class
|
|
|
98 |
['お帰りなさい,お兄様!', '29:米浴','日本語'],
|
99 |
['私の処女をもらっでください!', '29:米浴','日本語']]
|
100 |
|
101 |
+
duration_slider = gr.Slider(minimum=0.1, maximum=5, value=1, step=0.1, label='时长 Duration')
|
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, duration_slider, noise_scale_slider, noise_scale_w_slider,], outputs=["text","audio"],title=title, description=description, article=article, examples=examples).launch()
|