chenxiYan commited on
Commit
fb42bcc
1 Parent(s): 6548994

clean user_text

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -42,7 +42,7 @@ def get_response(user_name, user_text, role, chatbot):
42
  verbose=True)
43
  response = haruhi.chat(role=user_name, text=user_text)
44
  chatbot.append((user_text, response))
45
- return chatbot
46
 
47
 
48
  def clear(user_name, user_text, chatbot):
@@ -90,7 +90,7 @@ with gr.Blocks() as demo:
90
  '韦小宝', '乔峰', '神里绫华',
91
  '雷电将军', '于谦'], label="characters", value='凉宫春日')
92
  role.change(get_image, role, [role_image, user_name, user_text, chatbot])
93
- user_text.submit(fn=get_response, inputs=[user_name, user_text, role, chatbot], outputs=[chatbot])
94
- submit.click(fn=get_response, inputs=[user_name, user_text, role, chatbot], outputs=[chatbot])
95
  clean.click(clear, [user_name, user_text, chatbot], [user_name, user_text, chatbot])
96
  demo.launch(debug=True)
 
42
  verbose=True)
43
  response = haruhi.chat(role=user_name, text=user_text)
44
  chatbot.append((user_text, response))
45
+ return chatbot, None
46
 
47
 
48
  def clear(user_name, user_text, chatbot):
 
90
  '韦小宝', '乔峰', '神里绫华',
91
  '雷电将军', '于谦'], label="characters", value='凉宫春日')
92
  role.change(get_image, role, [role_image, user_name, user_text, chatbot])
93
+ user_text.submit(fn=get_response, inputs=[user_name, user_text, role, chatbot], outputs=[chatbot, user_text])
94
+ submit.click(fn=get_response, inputs=[user_name, user_text, role, chatbot], outputs=[chatbot, user_text])
95
  clean.click(clear, [user_name, user_text, chatbot], [user_name, user_text, chatbot])
96
  demo.launch(debug=True)