Antoine245 commited on
Commit
8c633f6
·
1 Parent(s): 5b1b306

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -32,17 +32,17 @@ with gr.Blocks() as demo:
32
  clear = gr.ClearButton([msg, chatbot])
33
 
34
  def respond(message, chat_history):
35
- # chat_history.append(message) # Initialize chat history
36
  bot_message = palm.chat(
37
  context=context,
38
  examples=examples,
39
  messages=chat_history
40
  )
41
  bot_message = bot_message.last # Get the last response
42
- chat_history.append((message,bot_message)) # Append the bot's message to the chat history
43
  time.sleep(2)
44
- return message, bot_message
45
 
46
- msg.submit(respond,[msg,chatbot],[msg,chatbot])
47
 
48
  demo.launch()
 
32
  clear = gr.ClearButton([msg, chatbot])
33
 
34
  def respond(message, chat_history):
35
+ chat_history.append(message) # Initialize chat history
36
  bot_message = palm.chat(
37
  context=context,
38
  examples=examples,
39
  messages=chat_history
40
  )
41
  bot_message = bot_message.last # Get the last response
42
+ chat_history.append(bot_message) # Append the bot's message to the chat history
43
  time.sleep(2)
44
+ return bot_message
45
 
46
+ msg.submit(respond,[msg,chatbot],chatbot)
47
 
48
  demo.launch()