Plachta commited on
Commit
12a0f39
1 Parent(s): 11c3532

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -47,11 +47,8 @@ If your input language is not Japanese, it will be translated to Japanese by Goo
47
  article = """
48
 
49
  """
50
- duration_slider = gr.Slider(minimum=0.1, maximum=5, value=1, step=0.1, label='时长 Duration', interactive=True)
51
- noise_scale_slider = gr.Slider(minimum=0.1, maximum=5, value=0.667, step=0.001, label='噪声比例 noise_scale', interactive=True),
52
- noise_scale_w_slider = gr.Slider(minimum=0.1, maximum=5, value=0.8, step=0.1, label='噪声偏差 noise_scale_w', interactive=True),
53
 
54
- def infer(text, character, language, duration, noise_scale, noise_scale_w):
55
  if language == '日本語':
56
  pass
57
  elif language == '简体中文':
@@ -64,7 +61,7 @@ def infer(text, character, language, duration, noise_scale, noise_scale_w):
64
  x_tst = stn_tst.unsqueeze(0)
65
  x_tst_lengths = torch.LongTensor([stn_tst.size(0)])
66
  sid = torch.LongTensor([char_id])
67
- 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()
68
  return (text,(22050, audio))
69
 
70
  # We instantiate the Textbox class
@@ -99,5 +96,5 @@ examples = [['お疲れ様です,トレーナーさん。', '1:无声铃鹿',
99
  ['授業中に出しだら,学校生活終わるですわ。', '12:目白麦昆','日本語'],
100
  ['お帰りなさい,お兄様!', '29:米浴','日本語'],
101
  ['私の処女をもらっでください!', '29:米浴','日本語']]
102
- gr.Interface(fn=infer, inputs=[textbox, char_dropdown, language_dropdown, duration_slider, noise_scale_slider, noise_scale_w_slider], outputs=["text","audio"],
103
  title=title, description=description, article=article, examples = examples).launch()
 
47
  article = """
48
 
49
  """
 
 
 
50
 
51
+ def infer(text, character, language):
52
  if language == '日本語':
53
  pass
54
  elif language == '简体中文':
 
61
  x_tst = stn_tst.unsqueeze(0)
62
  x_tst_lengths = torch.LongTensor([stn_tst.size(0)])
63
  sid = torch.LongTensor([char_id])
64
+ 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()
65
  return (text,(22050, audio))
66
 
67
  # We instantiate the Textbox class
 
96
  ['授業中に出しだら,学校生活終わるですわ。', '12:目白麦昆','日本語'],
97
  ['お帰りなさい,お兄様!', '29:米浴','日本語'],
98
  ['私の処女をもらっでください!', '29:米浴','日本語']]
99
+ gr.Interface(fn=infer, inputs=[textbox, char_dropdown, language_dropdown], outputs=["text","audio"],
100
  title=title, description=description, article=article, examples = examples).launch()