CrawfordZhou commited on
Commit
55234f5
1 Parent(s): 3e659cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -80,8 +80,8 @@ def infer(text, sdp_ratio, noise_scale, noise_scale_w, length_scale, sid):
80
  del x_tst, tones, lang_ids, bert, x_tst_lengths, speakers
81
  return audio
82
 
83
- def tts_fn(text, font, key, speaker, sdp_ratio, noise_scale, noise_scale_w, length_scale):
84
- message = gpt_35_api(key, font + text)
85
  with torch.no_grad():
86
  audio = infer(message, sdp_ratio=sdp_ratio, noise_scale=noise_scale, noise_scale_w=noise_scale_w, length_scale=length_scale, sid=speaker)
87
  return "Success", message, (hps.data.sampling_rate, audio)
@@ -145,8 +145,6 @@ if __name__ == "__main__":
145
  with gr.Column():
146
  text = gr.TextArea(label="请输入要提问然然的问题", placeholder="Input Text Here",
147
  value="虚拟主播是什么?")
148
- front_text = gr.TextArea(label="请输入情景语言", placeholder="请输入情景语言",
149
- value="你是一个叫嘉然的虚拟主播,")
150
  key = gr.Text(label="GPT Key(过期请更换)", placeholder="请输入上面提示中获取的gpt key",
151
  value="izlrijShDu7tp2rIgvYfibcC2J0Eh3uWfdm9ndrxN5nWrL96")
152
  speaker = gr.Dropdown(choices=speakers, value=speakers[0], label='说话人')
@@ -160,7 +158,7 @@ if __name__ == "__main__":
160
  gpt_output = gr.TextArea(label="然然老师的文字回答")
161
  audio_output = gr.Audio(label="然然老师的语音回答")
162
  btn.click(tts_fn,
163
- inputs=[text, front_text, key, speaker, sdp_ratio, noise_scale, noise_scale_w, length_scale],
164
  outputs=[text_output, gpt_output, audio_output])
165
 
166
  # webbrowser.open("http://127.0.0.1:6006")
 
80
  del x_tst, tones, lang_ids, bert, x_tst_lengths, speakers
81
  return audio
82
 
83
+ def tts_fn(text, key, speaker, sdp_ratio, noise_scale, noise_scale_w, length_scale):
84
+ message = gpt_35_api(key, text)
85
  with torch.no_grad():
86
  audio = infer(message, sdp_ratio=sdp_ratio, noise_scale=noise_scale, noise_scale_w=noise_scale_w, length_scale=length_scale, sid=speaker)
87
  return "Success", message, (hps.data.sampling_rate, audio)
 
145
  with gr.Column():
146
  text = gr.TextArea(label="请输入要提问然然的问题", placeholder="Input Text Here",
147
  value="虚拟主播是什么?")
 
 
148
  key = gr.Text(label="GPT Key(过期请更换)", placeholder="请输入上面提示中获取的gpt key",
149
  value="izlrijShDu7tp2rIgvYfibcC2J0Eh3uWfdm9ndrxN5nWrL96")
150
  speaker = gr.Dropdown(choices=speakers, value=speakers[0], label='说话人')
 
158
  gpt_output = gr.TextArea(label="然然老师的文字回答")
159
  audio_output = gr.Audio(label="然然老师的语音回答")
160
  btn.click(tts_fn,
161
+ inputs=[text, key, speaker, sdp_ratio, noise_scale, noise_scale_w, length_scale],
162
  outputs=[text_output, gpt_output, audio_output])
163
 
164
  # webbrowser.open("http://127.0.0.1:6006")