Sina Media Lab
commited on
Commit
·
337bde4
1
Parent(s):
1aa9e6d
Updates
Browse files
app.py
CHANGED
|
@@ -50,8 +50,6 @@ if 'module_question_count' not in st.session_state:
|
|
| 50 |
st.session_state.module_question_count = {name: 0 for name in module_names}
|
| 51 |
if 'selected_answer' not in st.session_state:
|
| 52 |
st.session_state.selected_answer = None
|
| 53 |
-
if 'dummy' not in st.session_state: # Dummy variable for triggering reruns
|
| 54 |
-
st.session_state.dummy = False
|
| 55 |
if 'pdf_data' not in st.session_state:
|
| 56 |
st.session_state.pdf_data = None
|
| 57 |
|
|
@@ -169,16 +167,15 @@ if not current_question.get('answered', False):
|
|
| 169 |
st.session_state.correct_count += 1
|
| 170 |
st.session_state.module_correct_count[module_name] += 1
|
| 171 |
|
| 172 |
-
# Trigger a UI update by toggling a dummy variable
|
| 173 |
-
st.session_state.dummy = not st.session_state.dummy
|
| 174 |
-
|
| 175 |
# Show correct/incorrect feedback after submission
|
| 176 |
if current_question.get('answered', False):
|
| 177 |
for option in current_question['options']:
|
| 178 |
if option == current_question['correct_answer']:
|
| 179 |
-
st.
|
| 180 |
elif option == current_question['selected']:
|
| 181 |
-
st.
|
|
|
|
|
|
|
| 182 |
|
| 183 |
# Show explanation and step-by-step solution
|
| 184 |
st.write(f"**Explanation:** {current_question['explanation']}")
|
|
|
|
| 50 |
st.session_state.module_question_count = {name: 0 for name in module_names}
|
| 51 |
if 'selected_answer' not in st.session_state:
|
| 52 |
st.session_state.selected_answer = None
|
|
|
|
|
|
|
| 53 |
if 'pdf_data' not in st.session_state:
|
| 54 |
st.session_state.pdf_data = None
|
| 55 |
|
|
|
|
| 167 |
st.session_state.correct_count += 1
|
| 168 |
st.session_state.module_correct_count[module_name] += 1
|
| 169 |
|
|
|
|
|
|
|
|
|
|
| 170 |
# Show correct/incorrect feedback after submission
|
| 171 |
if current_question.get('answered', False):
|
| 172 |
for option in current_question['options']:
|
| 173 |
if option == current_question['correct_answer']:
|
| 174 |
+
st.markdown(f"<span style='color:green;'>{option} ✅</span>", unsafe_allow_html=True)
|
| 175 |
elif option == current_question['selected']:
|
| 176 |
+
st.markdown(f"<span style='color:red;'>{option} ❌</span>", unsafe_allow_html=True)
|
| 177 |
+
else:
|
| 178 |
+
st.markdown(f"{option}")
|
| 179 |
|
| 180 |
# Show explanation and step-by-step solution
|
| 181 |
st.write(f"**Explanation:** {current_question['explanation']}")
|