CMLL commited on
Commit
d6087e3
1 Parent(s): 7463509

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -66,12 +66,17 @@ def clear_history():
66
  return [], []
67
 
68
  # 多轮界面
69
- multi_turn_interface = gr.Interface(
70
- lambda x, y: multi_turn_chat(x, y)[0],
71
- ["text", "state"],
72
- ["chatbot", "state"],
73
- title="仲景GPT-V2-1.8B 多轮对话",
74
- allow_flagging="never",
75
- )
 
 
 
 
 
76
 
77
- multi_turn_interface.queue(concurrency_count=10, max_size=20).launch(debug=True, server_name='0.0.0.0', server_port=6006)
 
66
  return [], []
67
 
68
  # 多轮界面
69
+ with gr.Blocks() as multi_turn_interface:
70
+ chatbot = gr.Chatbot(label="仲景GPT-V2-1.8B 多轮对话")
71
+ state = gr.State([])
72
+ with gr.Row():
73
+ with gr.Column(scale=6):
74
+ user_input = gr.Textbox(label="输入",placeholder="输入你的问题")
75
+ with gr.Column(scale=1):
76
+ submit_btn = gr.Button("提交")
77
+ clear_history_btn = gr.Button("清除历史对话")
78
+ submit_btn.click(multi_turn_chat, [user_input, state], [chatbot, state], concurrency_limit=10)
79
+ clear_history_btn.click(fn=clear_history, inputs=None, outputs=[chatbot, state], queue=False)
80
+ user_input.submit(multi_turn_chat, [user_input, state], [chatbot, state], concurrency_limit=10)
81
 
82
+ multi_turn_interface.launch(debug=True, server_name='0.0.0.0', server_port=6006, max_threads=200)