wahab5763 commited on
Commit
db6befa
·
verified ·
1 Parent(s): f1f6f3e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -126,20 +126,17 @@ if "profile_data" in st.session_state:
126
 
127
  if st.button("Submit Answer", key=f"submit{st.session_state.question_index}"):
128
  if answer:
129
- st.warning("Data saved successfully. click again to proceed")
130
- # Save the answer and increment the question index
131
- st.session_state.question_index += 1
132
  st.session_state.answers[question] = answer
133
-
134
- # No need to call a special function; the app will rerun automatically
135
  else:
136
  st.warning("Please enter an answer before submitting.")
137
  else:
138
  st.success("All questions have been answered. Click below to generate your recommendations.")
139
  if st.button("Generate Response"):
140
- st.warning("Data saved successfully. click again to proceed")
141
  st.session_state.profile_data.update(st.session_state.answers)
142
  st.session_state.ask_additional_questions = False
 
143
 
144
  elif st.session_state.get("ask_additional_questions") is False:
145
  # Directly generate recommendations
 
126
 
127
  if st.button("Submit Answer", key=f"submit{st.session_state.question_index}"):
128
  if answer:
 
 
 
129
  st.session_state.answers[question] = answer
130
+ st.session_state.question_index += 1
131
+ st.rerun() # Trigger app rerun to show the next question
132
  else:
133
  st.warning("Please enter an answer before submitting.")
134
  else:
135
  st.success("All questions have been answered. Click below to generate your recommendations.")
136
  if st.button("Generate Response"):
 
137
  st.session_state.profile_data.update(st.session_state.answers)
138
  st.session_state.ask_additional_questions = False
139
+ st.rerun() # Trigger app rerun after completing all questions
140
 
141
  elif st.session_state.get("ask_additional_questions") is False:
142
  # Directly generate recommendations