chilge commited on
Commit
c4cb69e
1 Parent(s): 44847f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -67,16 +67,16 @@ def tts(txt, emotion, roma=False, length_scale=1):
67
  else:
68
  print("emotion参数不正确")
69
 
70
- audio = net_g.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=0.667, noise_scale_w=0.8, length_scale=1.2, emo=emo)[0][0,0].data.float().numpy()
71
- ipd.display(ipd.Audio(audio, rate=hps.data.sampling_rate, normalize=False))
72
 
73
  def generate_audio(txt, emotion):
74
- tts(txt, emotion)
 
75
 
76
  input_text = gr.inputs.Textbox(label="输入文本")
77
  input_emotion = gr.inputs.Dropdown(choices=["random_sample"] + os.listdir(random_emotion_root), label="参考情感音频")
78
  output_audio = gr.outputs.Audio(type="numpy", label="合成音频")
79
 
80
-
81
  iface = gr.Interface(fn=generate_audio, inputs=[input_text, input_emotion], outputs=output_audio)
82
  iface.launch()
 
67
  else:
68
  print("emotion参数不正确")
69
 
70
+ audio = net_g.infer(x_tst, x_tst_lengths, sid=sid, noise_scale=0.667, noise_scale_w=0.8, length_scale=1.2, emo=emo)[0][0,0].data.float().numpy()
71
+ return audio
72
 
73
  def generate_audio(txt, emotion):
74
+ audio = tts(txt, emotion)
75
+ return audio
76
 
77
  input_text = gr.inputs.Textbox(label="输入文本")
78
  input_emotion = gr.inputs.Dropdown(choices=["random_sample"] + os.listdir(random_emotion_root), label="参考情感音频")
79
  output_audio = gr.outputs.Audio(type="numpy", label="合成音频")
80
 
 
81
  iface = gr.Interface(fn=generate_audio, inputs=[input_text, input_emotion], outputs=output_audio)
82
  iface.launch()