Antoine245 commited on
Commit
5b1b306
·
1 Parent(s): 7aaad7d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -32,14 +32,14 @@ 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
- # 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 message, bot_message
45
 
 
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