Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -210,17 +210,24 @@ def get_response(query):
|
|
| 210 |
|
| 211 |
|
| 212 |
with gr.Blocks() as iface:
|
|
|
|
|
|
|
|
|
|
| 213 |
chatbot = gr.Chatbot()
|
| 214 |
msg = gr.Textbox()
|
| 215 |
clear = gr.ClearButton([msg, chatbot])
|
| 216 |
|
|
|
|
|
|
|
|
|
|
| 217 |
def respond(message, chat_history):
|
| 218 |
bot_message = get_response(message)
|
| 219 |
chat_history.append((message, bot_message))
|
| 220 |
time.sleep(2)
|
| 221 |
return "", chat_history
|
| 222 |
|
| 223 |
-
|
|
|
|
| 224 |
|
| 225 |
if __name__ == "__main__":
|
| 226 |
iface.launch()
|
|
|
|
| 210 |
|
| 211 |
|
| 212 |
with gr.Blocks() as iface:
|
| 213 |
+
iface.title("Chat with the British Chatbot!")
|
| 214 |
+
iface.description("Hi friend! Please note that:\n- Our chats are not private.\n- I'm still undergoing training (I'm not perfect).\n- I'm not ChatGPT (My knowledge base is limited to class-related issues).\n- You're allowed only 5 messages daily.\n- I'm British ;)")
|
| 215 |
+
|
| 216 |
chatbot = gr.Chatbot()
|
| 217 |
msg = gr.Textbox()
|
| 218 |
clear = gr.ClearButton([msg, chatbot])
|
| 219 |
|
| 220 |
+
# Add submit button
|
| 221 |
+
submit_button = gr.Button(text="Submit")
|
| 222 |
+
|
| 223 |
def respond(message, chat_history):
|
| 224 |
bot_message = get_response(message)
|
| 225 |
chat_history.append((message, bot_message))
|
| 226 |
time.sleep(2)
|
| 227 |
return "", chat_history
|
| 228 |
|
| 229 |
+
# Link submit button to respond function
|
| 230 |
+
submit_button.link(respond, [msg, chatbot], [msg, chatbot])
|
| 231 |
|
| 232 |
if __name__ == "__main__":
|
| 233 |
iface.launch()
|