soroushsrd commited on
Commit
249352a
·
verified ·
1 Parent(s): 338f18e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -117,13 +117,13 @@ question = st.text_input('Write your question below:')
117
  if st.button('Enter'):
118
  if question:
119
  answer = get_answer(question)
120
- st.session_state.faq_answer = "" # Clear FAQ answer when a custom question is asked
121
  st.session_state.custom_answer = f"**Answer:** {answer}"
122
  else:
123
  st.write("Please enter a question.")
124
 
125
  # Display the answer to the custom question in the main window
126
  if st.session_state.custom_answer:
 
127
  st.write(st.session_state.custom_answer)
128
 
129
  # Show initial 10 questions
@@ -131,11 +131,11 @@ faq_expander = st.sidebar.expander("FAQs")
131
  with faq_expander:
132
  for i, faq in enumerate(faq_questions):
133
  if st.sidebar.button(f"Q{i+1}: {faq}", key=f"faq{i+1}"):
134
- st.session_state.custom_answer = "" # Clear custom answer when FAQ is clicked
135
  st.session_state.faq_answer = f"**Answer to Q{i+1}:** {precomputed_faq_answers[faq]}"
136
 
137
  # Display the answer to the selected FAQ in the main window
138
  if st.session_state.faq_answer:
 
139
  st.write(st.session_state.faq_answer)
140
 
141
 
 
117
  if st.button('Enter'):
118
  if question:
119
  answer = get_answer(question)
 
120
  st.session_state.custom_answer = f"**Answer:** {answer}"
121
  else:
122
  st.write("Please enter a question.")
123
 
124
  # Display the answer to the custom question in the main window
125
  if st.session_state.custom_answer:
126
+ st.session_state.faq_answer = "" # Clear FAQ answer when a custom question is asked
127
  st.write(st.session_state.custom_answer)
128
 
129
  # Show initial 10 questions
 
131
  with faq_expander:
132
  for i, faq in enumerate(faq_questions):
133
  if st.sidebar.button(f"Q{i+1}: {faq}", key=f"faq{i+1}"):
 
134
  st.session_state.faq_answer = f"**Answer to Q{i+1}:** {precomputed_faq_answers[faq]}"
135
 
136
  # Display the answer to the selected FAQ in the main window
137
  if st.session_state.faq_answer:
138
+ st.session_state.custom_answer = "" # Clear custom answer when FAQ is clicked
139
  st.write(st.session_state.faq_answer)
140
 
141