Update app.py
Browse files
app.py
CHANGED
|
@@ -130,7 +130,7 @@ def add_message(history, message):
|
|
| 130 |
Returns the updated chatbot with an empty input textbox.
|
| 131 |
"""
|
| 132 |
history.append((message, None))
|
| 133 |
-
return history
|
| 134 |
|
| 135 |
def bot(history,message):
|
| 136 |
"""
|
|
@@ -142,7 +142,7 @@ def bot(history,message):
|
|
| 142 |
for character in response:
|
| 143 |
history[-1][1] += character
|
| 144 |
time.sleep(0.05)
|
| 145 |
-
yield history
|
| 146 |
|
| 147 |
|
| 148 |
@spaces.GPU()
|
|
@@ -213,8 +213,8 @@ with gr.Blocks(
|
|
| 213 |
elem_id="chat_input",
|
| 214 |
visible=True
|
| 215 |
)
|
| 216 |
-
|
| 217 |
-
|
| 218 |
bot_msg = chat_msg.then(bot, [chatbot, chat_input], chatbot, api_name="bot_response")
|
| 219 |
bot_msg.then(lambda: gr.Textbox(interactive=False), None, [chat_input])
|
| 220 |
|
|
|
|
| 130 |
Returns the updated chatbot with an empty input textbox.
|
| 131 |
"""
|
| 132 |
history.append((message, None))
|
| 133 |
+
return history
|
| 134 |
|
| 135 |
def bot(history,message):
|
| 136 |
"""
|
|
|
|
| 142 |
for character in response:
|
| 143 |
history[-1][1] += character
|
| 144 |
time.sleep(0.05)
|
| 145 |
+
yield history
|
| 146 |
|
| 147 |
|
| 148 |
@spaces.GPU()
|
|
|
|
| 213 |
elem_id="chat_input",
|
| 214 |
visible=True
|
| 215 |
)
|
| 216 |
+
|
| 217 |
+
chat_msg = chat_input.change(add_message, [chatbot, chat_input], [chatbot])
|
| 218 |
bot_msg = chat_msg.then(bot, [chatbot, chat_input], chatbot, api_name="bot_response")
|
| 219 |
bot_msg.then(lambda: gr.Textbox(interactive=False), None, [chat_input])
|
| 220 |
|