ngcanh commited on
Commit
08fa6fe
·
verified ·
1 Parent(s): d685d1d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -21
app.py CHANGED
@@ -87,28 +87,27 @@ def main():
87
  st.session_state.chat_history = []
88
  st.rerun()
89
  # Main chat interface
90
- if st.session_state.pdf_processed:
91
- st.header("💬 Ask About Your Insurance Policy")
92
- # Display chat history
93
- for i, (question, answer) in enumerate(st.session_state.chat_history):
94
- with st.container():
95
- st.markdown(f"**You:** {question}")
96
- st.markdown(f"**Insurance Assistant:** {answer}")
97
- st.divider()
98
  # Chat input
99
- user_question = st.chat_input("Hãy đặt những câu hỏi về hợp đồng bảo hiểm cơ bản...")
100
- if user_question:
101
- with st.spinner("Analyzing your policy..."):
102
- # Get response from chatbot
103
- response = st.session_state.chatbot.chat_with_pdf(
104
- user_question,
105
- st.session_state.chatbot.pdf_content
106
- )
107
- # Add to chat history
108
- st.session_state.chat_history.append((user_question, response))
109
- # Display the new response
110
- st.markdown(f"**You:** {user_question}")
111
- st.markdown(f"**Insurance Assistant:** {response}")
112
  else:
113
  # Show example questions
114
  st.subheader("Các câu hỏi bạn có thể hỏi:")
 
87
  st.session_state.chat_history = []
88
  st.rerun()
89
  # Main chat interface
90
+ st.header("💬 Ask About Your Insurance Policy")
91
+ # Display chat history
92
+ for i, (question, answer) in enumerate(st.session_state.chat_history):
93
+ with st.container():
94
+ st.markdown(f"**You:** {question}")
95
+ st.markdown(f"**Insurance Assistant:** {answer}")
96
+ st.divider()
 
97
  # Chat input
98
+ user_question = st.chat_input("Hãy đặt những câu hỏi về hợp đồng bảo hiểm cơ bản...")
99
+ if user_question:
100
+ with st.spinner("Analyzing your policy..."):
101
+ # Get response from chatbot
102
+ response = st.session_state.chatbot.chat_with_pdf(
103
+ user_question,
104
+ st.session_state.chatbot.pdf_content
105
+ )
106
+ # Add to chat history
107
+ st.session_state.chat_history.append((user_question, response))
108
+ # Display the new response
109
+ st.markdown(f"**You:** {user_question}")
110
+ st.markdown(f"**Insurance Assistant:** {response}")
111
  else:
112
  # Show example questions
113
  st.subheader("Các câu hỏi bạn có thể hỏi:")