Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -67,6 +67,7 @@ with gr.Blocks() as demo:
|
|
67 |
chatbot = gr.Chatbot([], elem_id="chatbot")
|
68 |
msg = gr.Textbox()
|
69 |
clear = gr.Button("Clear")
|
|
|
70 |
# fn to add user message to history
|
71 |
def user(user_message, history):
|
72 |
return "", history + [[user_message, None]]
|
@@ -83,7 +84,12 @@ with gr.Blocks() as demo:
|
|
83 |
bot, chatbot, chatbot
|
84 |
)
|
85 |
|
|
|
|
|
|
|
|
|
86 |
clear.click(lambda: None, None, chatbot, queue=False)
|
87 |
|
|
|
88 |
if __name__ == "__main__":
|
89 |
demo.queue().launch(share=True)
|
|
|
67 |
chatbot = gr.Chatbot([], elem_id="chatbot")
|
68 |
msg = gr.Textbox()
|
69 |
clear = gr.Button("Clear")
|
70 |
+
send_button = gr.Button("Send") # Add a send button
|
71 |
# fn to add user message to history
|
72 |
def user(user_message, history):
|
73 |
return "", history + [[user_message, None]]
|
|
|
84 |
bot, chatbot, chatbot
|
85 |
)
|
86 |
|
87 |
+
send_button.click(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
88 |
+
bot, chatbot, chatbot
|
89 |
+
)
|
90 |
+
|
91 |
clear.click(lambda: None, None, chatbot, queue=False)
|
92 |
|
93 |
+
|
94 |
if __name__ == "__main__":
|
95 |
demo.queue().launch(share=True)
|