Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
import gradio as gr
|
2 |
from src.chatbot import RestaurantChatbot
|
3 |
|
4 |
-
|
5 |
chat_history = []
|
6 |
|
7 |
-
|
8 |
response, retrieved_docs = chatbot.answer(user_message)
|
9 |
|
10 |
-
|
11 |
if retrieved_docs:
|
12 |
for doc in retrieved_docs:
|
13 |
bot_response += (
|
@@ -22,10 +22,10 @@ chat_history = []
|
|
22 |
else:
|
23 |
bot_response += "- Không tìm thấy nhà hàng phù hợp."
|
24 |
|
25 |
-
|
26 |
|
27 |
-
|
28 |
gr.Markdown("## Chatbot Gợi ý Quán ăn")
|
29 |
chatbot_ui = gr.ChatInterface(fn=respond, chatbot=gr.Chatbot())
|
30 |
|
31 |
-
|
|
|
1 |
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"
|
11 |
if retrieved_docs:
|
12 |
for doc in retrieved_docs:
|
13 |
bot_response += (
|
|
|
22 |
else:
|
23 |
bot_response += "- Không tìm thấy nhà hàng phù hợp."
|
24 |
|
25 |
+
return bot_response
|
26 |
|
27 |
+
with gr.Blocks() as demo:
|
28 |
gr.Markdown("## Chatbot Gợi ý Quán ăn")
|
29 |
chatbot_ui = gr.ChatInterface(fn=respond, chatbot=gr.Chatbot())
|
30 |
|
31 |
+
demo.launch()
|