Mahiruoshi commited on
Commit
fc801ef
·
1 Parent(s): 7c79bb2

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -2
main.py CHANGED
@@ -35,7 +35,7 @@ class VitsGradio:
35
  self.text = gr.TextArea(label="Text", value="你好")
36
  with gr.Accordion(label="测试api", open=False):
37
  self.local_chat1 = gr.Checkbox(value=False, label="使用网址+文本进行模拟")
38
- self.url_input = gr.TextArea(label="键入测试", value="http://127.0.0.1:8080/chat?Text=")
39
  butto = gr.Button("模拟前端抓取语音文件")
40
  btnVC = gr.Button("测试tts+对话程序")
41
  with gr.Column():
@@ -220,6 +220,7 @@ print("开始部署")
220
  grVits = VitsGradio()
221
 
222
  @app.route('/chat')
 
223
  def text_api():
224
  message = request.args.get('Text','')
225
  audio,text = grVits.tts_fn(message)
@@ -230,12 +231,16 @@ def text_api():
230
  'Content-Type': 'audio/wav',
231
  'Text': text.encode('utf-8')}
232
  return wav_bytes, 200, headers
233
-
234
  def gradio_interface():
235
  return grVits.Vits.launch()
236
 
237
  if __name__ == '__main__':
 
238
  api_thread = Thread(target=app.run, args=("0.0.0.0", 8080))
 
239
  gradio_thread = Thread(target=gradio_interface)
 
240
  api_thread.start()
 
241
  gradio_thread.start()
 
35
  self.text = gr.TextArea(label="Text", value="你好")
36
  with gr.Accordion(label="测试api", open=False):
37
  self.local_chat1 = gr.Checkbox(value=False, label="使用网址+文本进行模拟")
38
+ self.url_input = gr.TextArea(label="键入测试", value="http://YourHost:8080/chat?Text=")
39
  butto = gr.Button("模拟前端抓取语音文件")
40
  btnVC = gr.Button("测试tts+对话程序")
41
  with gr.Column():
 
220
  grVits = VitsGradio()
221
 
222
  @app.route('/chat')
223
+ '''
224
  def text_api():
225
  message = request.args.get('Text','')
226
  audio,text = grVits.tts_fn(message)
 
231
  'Content-Type': 'audio/wav',
232
  'Text': text.encode('utf-8')}
233
  return wav_bytes, 200, headers
234
+ '''
235
  def gradio_interface():
236
  return grVits.Vits.launch()
237
 
238
  if __name__ == '__main__':
239
+ '''
240
  api_thread = Thread(target=app.run, args=("0.0.0.0", 8080))
241
+ '''
242
  gradio_thread = Thread(target=gradio_interface)
243
+ '''
244
  api_thread.start()
245
+ '''
246
  gradio_thread.start()