hieu-nguyen2208 commited on
Commit
bf62ebb
·
1 Parent(s): b106d46
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -2,8 +2,9 @@ import gradio as gr
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,11 +22,10 @@ def respond(user_message, history: list):
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()
 
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
  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()