yzhuang commited on
Commit
a967284
·
1 Parent(s): fb33d5d
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -38,7 +38,7 @@ with gr.Blocks() as demo:
38
  top_p = gr.Slider(0.0, 1.0, value=0.95, label="Top-p")
39
  beta = gr.Slider(0.0, 10.0, value=1.0, label="MoI Beta")
40
 
41
- chatbot = gr.Chatbot()
42
  message = gr.Textbox(label="Your message")
43
  send_btn = gr.Button("Send")
44
 
@@ -46,7 +46,8 @@ with gr.Blocks() as demo:
46
 
47
  def respond(user_message, chat_history, temperature, top_p, beta):
48
  reply = chat_with_moi(user_message, chat_history, temperature, top_p, beta)
49
- chat_history = chat_history + [(user_message, reply)]
 
50
  return chat_history, chat_history
51
 
52
  send_btn.click(respond, inputs=[message, history, temperature, top_p, beta],
 
38
  top_p = gr.Slider(0.0, 1.0, value=0.95, label="Top-p")
39
  beta = gr.Slider(0.0, 10.0, value=1.0, label="MoI Beta")
40
 
41
+ chatbot = gr.Chatbot(type="messages")
42
  message = gr.Textbox(label="Your message")
43
  send_btn = gr.Button("Send")
44
 
 
46
 
47
  def respond(user_message, chat_history, temperature, top_p, beta):
48
  reply = chat_with_moi(user_message, chat_history, temperature, top_p, beta)
49
+ chat_history = chat_history + [{"role": "user", "content": user_message},
50
+ {"role": "assistant", "content": reply}]
51
  return chat_history, chat_history
52
 
53
  send_btn.click(respond, inputs=[message, history, temperature, top_p, beta],