Plachta commited on
Commit
e0866ea
1 Parent(s): 85e3558

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -49,7 +49,7 @@ article = """
49
  """
50
 
51
 
52
- def infer(text, character, language, duration, noise_scale, noise_scale_w):
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=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
@@ -102,4 +102,4 @@ duration_slider = gr.Slider(minimum=0.1, maximum=5, value=1, step=0.1, label='
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()
 
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], outputs=["text","audio"],title=title, description=description, article=article, examples=examples).launch()