Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,14 +33,16 @@ with gr.Blocks() as demo:
|
|
| 33 |
msg = gr.Textbox(placeholder="Type a message...")
|
| 34 |
|
| 35 |
def respond(user_input, chat_history):
|
| 36 |
-
# stream output
|
| 37 |
bot_reply = ""
|
|
|
|
|
|
|
| 38 |
for partial in chat_fn_stream(user_input):
|
| 39 |
bot_reply = partial
|
| 40 |
-
#
|
| 41 |
chat_history[-1] = (user_input, bot_reply)
|
| 42 |
yield chat_history, chat_history
|
| 43 |
|
|
|
|
| 44 |
state = gr.State([])
|
| 45 |
msg.submit(respond, [msg, state], [chatbot_ui, state])
|
| 46 |
|
|
|
|
| 33 |
msg = gr.Textbox(placeholder="Type a message...")
|
| 34 |
|
| 35 |
def respond(user_input, chat_history):
|
|
|
|
| 36 |
bot_reply = ""
|
| 37 |
+
# Start by adding the user input
|
| 38 |
+
chat_history.append((user_input, "")) # empty bot reply for now
|
| 39 |
for partial in chat_fn_stream(user_input):
|
| 40 |
bot_reply = partial
|
| 41 |
+
# Update the last bot reply
|
| 42 |
chat_history[-1] = (user_input, bot_reply)
|
| 43 |
yield chat_history, chat_history
|
| 44 |
|
| 45 |
+
|
| 46 |
state = gr.State([])
|
| 47 |
msg.submit(respond, [msg, state], [chatbot_ui, state])
|
| 48 |
|