Antoine245 commited on
Commit
4c1fcca
·
1 Parent(s): b5a6f7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -28,18 +28,18 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
28
  chatbot = gr.Chatbot()
29
  msg = gr.Textbox()
30
  btn = gr.Button("Submit", variant="primary")
31
- # gr.ClearButton([msg, chatbot])
32
  clear = gr.Button("Clear")
33
-
34
  def user(user_message, history):
35
- return gr.update(value=""), history + [[user_message, None]]
 
36
 
37
  def bot(history):
38
- try:
39
  bot_message = palm.chat(
40
  context=context,
41
  examples=examples,
42
- messages=history[-1][0]
43
  )
44
 
45
  history[-1][1] = ""
 
28
  chatbot = gr.Chatbot()
29
  msg = gr.Textbox()
30
  btn = gr.Button("Submit", variant="primary")
 
31
  clear = gr.Button("Clear")
32
+
33
  def user(user_message, history):
34
+ history.append([user_message, None])
35
+ return gr.update(value=""), history
36
 
37
  def bot(history):
38
+ try:
39
  bot_message = palm.chat(
40
  context=context,
41
  examples=examples,
42
+ messages=[h[0] for h in history]
43
  )
44
 
45
  history[-1][1] = ""