Upload app.py
Browse files
app.py
CHANGED
|
@@ -1012,7 +1012,8 @@ def chatbot_respond(user_text, history, session):
|
|
| 1012 |
bot = f"{info}\n\nWould you like navigation to {ROOM_INFO[info_room]} (Room {info_room})?"
|
| 1013 |
session["last_referenced_room"] = info_room
|
| 1014 |
session["last_dest_room"] = info_room
|
| 1015 |
-
history.append(
|
|
|
|
| 1016 |
try:
|
| 1017 |
gTTS(bot).save("/content/voice.mp3")
|
| 1018 |
except Exception:
|
|
@@ -1453,10 +1454,12 @@ with gr.Blocks(
|
|
| 1453 |
gr.HTML("<div style='color:#00d4ff;font-family:monospace;font-size:13px;margin-bottom:16px'>Chat with the mall AI assistant</div>")
|
| 1454 |
|
| 1455 |
chatbot_widget = gr.Chatbot(
|
| 1456 |
-
|
| 1457 |
-
|
| 1458 |
-
|
| 1459 |
-
|
|
|
|
|
|
|
| 1460 |
|
| 1461 |
with gr.Row():
|
| 1462 |
chat_msg = gr.Textbox(placeholder="Ask me anything about the mall...", label="Message", scale=4)
|
|
|
|
| 1012 |
bot = f"{info}\n\nWould you like navigation to {ROOM_INFO[info_room]} (Room {info_room})?"
|
| 1013 |
session["last_referenced_room"] = info_room
|
| 1014 |
session["last_dest_room"] = info_room
|
| 1015 |
+
history.append({"role": "user", "content": user_text})
|
| 1016 |
+
history.append({"role": "assistant", "content": bot})
|
| 1017 |
try:
|
| 1018 |
gTTS(bot).save("/content/voice.mp3")
|
| 1019 |
except Exception:
|
|
|
|
| 1454 |
gr.HTML("<div style='color:#00d4ff;font-family:monospace;font-size:13px;margin-bottom:16px'>Chat with the mall AI assistant</div>")
|
| 1455 |
|
| 1456 |
chatbot_widget = gr.Chatbot(
|
| 1457 |
+
label="SmartMall Assistant",
|
| 1458 |
+
height=480,
|
| 1459 |
+
value=[
|
| 1460 |
+
{"role": "assistant", "content": "👋 Welcome to SmartMall! I can help you navigate, find products, or answer any questions. How can I help?"}
|
| 1461 |
+
],
|
| 1462 |
+
)
|
| 1463 |
|
| 1464 |
with gr.Row():
|
| 1465 |
chat_msg = gr.Textbox(placeholder="Ask me anything about the mall...", label="Message", scale=4)
|