Spaces:
Runtime error
Runtime error
Commit
·
8c633f6
1
Parent(s):
5b1b306
Update app.py
Browse files
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 |
-
|
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(
|
43 |
time.sleep(2)
|
44 |
-
return
|
45 |
|
46 |
-
msg.submit(respond,[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()
|