Sina Media Lab
commited on
Commit
·
8c9ee4c
1
Parent(s):
ddd6703
Updates
Browse files
app.py
CHANGED
@@ -109,6 +109,12 @@ def navigate_question(direction):
|
|
109 |
st.session_state.current_index -= 1
|
110 |
elif direction == "next" and st.session_state.current_index < len(st.session_state.questions) - 1:
|
111 |
st.session_state.current_index += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
# Load all modules dynamically
|
114 |
modules = load_modules()
|
@@ -205,17 +211,9 @@ if submit_button:
|
|
205 |
for step in current_question['step_by_step_solution']:
|
206 |
st.write(step)
|
207 |
|
208 |
-
# Rerun to update the button states
|
209 |
-
st.experimental_rerun()
|
210 |
-
|
211 |
else:
|
212 |
st.warning("Please select an option before submitting.", icon="⚠️")
|
213 |
|
214 |
# Handle new question generation
|
215 |
if new_button:
|
216 |
-
|
217 |
-
st.session_state.questions.append(new_question)
|
218 |
-
st.session_state.current_index = len(st.session_state.questions) - 1
|
219 |
-
st.session_state.submit_enabled = True
|
220 |
-
st.session_state.new_enabled = False
|
221 |
-
st.experimental_rerun()
|
|
|
109 |
st.session_state.current_index -= 1
|
110 |
elif direction == "next" and st.session_state.current_index < len(st.session_state.questions) - 1:
|
111 |
st.session_state.current_index += 1
|
112 |
+
elif direction == "new":
|
113 |
+
new_question = generate_new_question(st.session_state.current_module, modules[st.session_state.current_module])
|
114 |
+
st.session_state.questions.append(new_question)
|
115 |
+
st.session_state.current_index = len(st.session_state.questions) - 1
|
116 |
+
st.session_state.submit_enabled = True
|
117 |
+
st.session_state.new_enabled = False
|
118 |
|
119 |
# Load all modules dynamically
|
120 |
modules = load_modules()
|
|
|
211 |
for step in current_question['step_by_step_solution']:
|
212 |
st.write(step)
|
213 |
|
|
|
|
|
|
|
214 |
else:
|
215 |
st.warning("Please select an option before submitting.", icon="⚠️")
|
216 |
|
217 |
# Handle new question generation
|
218 |
if new_button:
|
219 |
+
navigate_question("new")
|
|
|
|
|
|
|
|
|
|