Spaces:
Running
Running
Commit
·
b106d46
1
Parent(s):
ad54c47
"LOL"
Browse files
app.py
CHANGED
@@ -2,9 +2,8 @@ import gradio as gr
|
|
2 |
from src.chatbot import RestaurantChatbot
|
3 |
|
4 |
chatbot = RestaurantChatbot()
|
5 |
-
chat_history = []
|
6 |
|
7 |
-
def respond(user_message, history):
|
8 |
response, retrieved_docs = chatbot.answer(user_message)
|
9 |
|
10 |
bot_response = f"{response}\n\n**Nhà hàng gợi ý:**\n"
|
@@ -22,10 +21,11 @@ def respond(user_message, history):
|
|
22 |
else:
|
23 |
bot_response += "- Không tìm thấy nhà hàng phù hợp."
|
24 |
|
25 |
-
|
|
|
26 |
|
27 |
with gr.Blocks() as demo:
|
28 |
gr.Markdown("## Chatbot Gợi ý Quán ăn")
|
29 |
-
|
30 |
|
31 |
demo.launch()
|
|
|
2 |
from src.chatbot import RestaurantChatbot
|
3 |
|
4 |
chatbot = RestaurantChatbot()
|
|
|
5 |
|
6 |
+
def respond(user_message, history: list):
|
7 |
response, retrieved_docs = chatbot.answer(user_message)
|
8 |
|
9 |
bot_response = f"{response}\n\n**Nhà hàng gợi ý:**\n"
|
|
|
21 |
else:
|
22 |
bot_response += "- Không tìm thấy nhà hàng phù hợp."
|
23 |
|
24 |
+
history.append((user_message, bot_response))
|
25 |
+
return history, history
|
26 |
|
27 |
with gr.Blocks() as demo:
|
28 |
gr.Markdown("## Chatbot Gợi ý Quán ăn")
|
29 |
+
chat_interface = gr.ChatInterface(fn=respond)
|
30 |
|
31 |
demo.launch()
|