Spaces:
Build error
Build error
Updating UI, to add send button
#12
by mukiibi - opened
app.py
CHANGED
|
@@ -304,24 +304,43 @@ def respond(message, history, session_id):
|
|
| 304 |
|
| 305 |
return "", history
|
| 306 |
def create_interface():
|
| 307 |
-
with gr.Blocks() as demo:
|
| 308 |
-
gr.Markdown("""
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
|
|
|
|
|
|
| 318 |
|
| 319 |
session_id_box = gr.Textbox(label="Session ID", value=str(uuid.uuid4()), interactive=True)
|
| 320 |
|
| 321 |
-
chatbot = gr.Chatbot(
|
| 322 |
-
|
|
|
|
|
|
|
|
|
|
| 323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
msg.submit(respond, [msg, chatbot, session_id_box], [msg, chatbot])
|
|
|
|
| 325 |
return demo
|
| 326 |
|
| 327 |
if __name__ == "__main__":
|
|
|
|
| 304 |
|
| 305 |
return "", history
|
| 306 |
def create_interface():
|
| 307 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 308 |
+
gr.Markdown("""
|
| 309 |
+
# ASKXENO
|
| 310 |
+
**Welcome to XENO AI Support!**
|
| 311 |
+
|
| 312 |
+
I can help you with questions about XENO financial services including:
|
| 313 |
+
- Account management and setup
|
| 314 |
+
- Transaction processes and fees
|
| 315 |
+
- Platform features and troubleshooting
|
| 316 |
+
- General service information
|
| 317 |
+
|
| 318 |
+
*Simply type your question below to get started!*
|
| 319 |
+
""")
|
| 320 |
|
| 321 |
session_id_box = gr.Textbox(label="Session ID", value=str(uuid.uuid4()), interactive=True)
|
| 322 |
|
| 323 |
+
chatbot = gr.Chatbot(
|
| 324 |
+
label="XENO Assistant",
|
| 325 |
+
bubble_full_width=False,
|
| 326 |
+
height=500
|
| 327 |
+
)
|
| 328 |
|
| 329 |
+
with gr.Row():
|
| 330 |
+
msg = gr.Textbox(
|
| 331 |
+
label="Your Message",
|
| 332 |
+
placeholder="Type your question here...",
|
| 333 |
+
scale=3,
|
| 334 |
+
)
|
| 335 |
+
send_button = gr.Button("Send", variant="primary", scale=1)
|
| 336 |
+
|
| 337 |
+
def submit_message(message, chat_history, session_id):
|
| 338 |
+
new_msg, new_hist = respond(message, chat_history, session_id)
|
| 339 |
+
return "", new_hist
|
| 340 |
+
|
| 341 |
+
send_button.click(respond, [msg, chatbot, session_id_box], [msg, chatbot])
|
| 342 |
msg.submit(respond, [msg, chatbot, session_id_box], [msg, chatbot])
|
| 343 |
+
|
| 344 |
return demo
|
| 345 |
|
| 346 |
if __name__ == "__main__":
|