Update app.py
Browse files
app.py
CHANGED
|
@@ -281,23 +281,25 @@ if st.button("Generate Questions", key="generate_questions"):
|
|
| 281 |
with st.spinner("Generating questions..."):
|
| 282 |
questions = generate_questions(model_choice, role, question_type, num_questions, difficulty)
|
| 283 |
if questions:
|
| 284 |
-
question_index = st.session_state.get('question_index', 0)
|
| 285 |
st.session_state['questions'] = questions
|
| 286 |
-
st.session_state['question_index'] =
|
| 287 |
st.session_state['questions_count'] = len(questions)
|
| 288 |
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
|
|
|
|
|
|
|
|
|
| 301 |
|
| 302 |
st.header("🗣️ Provide Feedback")
|
| 303 |
answer = st.text_area("Submit Your Answer", key="text_area_answer")
|
|
@@ -336,4 +338,3 @@ st.markdown("""
|
|
| 336 |
</div>
|
| 337 |
""", unsafe_allow_html=True)
|
| 338 |
|
| 339 |
-
|
|
|
|
| 281 |
with st.spinner("Generating questions..."):
|
| 282 |
questions = generate_questions(model_choice, role, question_type, num_questions, difficulty)
|
| 283 |
if questions:
|
|
|
|
| 284 |
st.session_state['questions'] = questions
|
| 285 |
+
st.session_state['question_index'] = 0 # Reset index to start
|
| 286 |
st.session_state['questions_count'] = len(questions)
|
| 287 |
|
| 288 |
+
st.markdown(style_output("Question:", "#4CAF50"), unsafe_allow_html=True)
|
| 289 |
+
st.write(st.session_state['questions'][st.session_state['question_index']])
|
| 290 |
+
|
| 291 |
+
col1, col2 = st.columns([3, 1])
|
| 292 |
+
with col2:
|
| 293 |
+
if st.button("Next", key="next_question"):
|
| 294 |
+
if st.session_state['question_index'] + 1 < len(st.session_state['questions']):
|
| 295 |
+
st.session_state['question_index'] += 1
|
| 296 |
+
else:
|
| 297 |
+
st.session_state['question_index'] = 0 # Loop back to first question
|
| 298 |
+
st.success("You have reached the end of the questions.")
|
| 299 |
+
st.markdown(style_output("Question:", "#4CAF50"), unsafe_allow_html=True)
|
| 300 |
+
st.write(st.session_state['questions'][st.session_state['question_index']])
|
| 301 |
+
|
| 302 |
+
progress_data["questions_solved"][question_type] += num_questions
|
| 303 |
|
| 304 |
st.header("🗣️ Provide Feedback")
|
| 305 |
answer = st.text_area("Submit Your Answer", key="text_area_answer")
|
|
|
|
| 338 |
</div>
|
| 339 |
""", unsafe_allow_html=True)
|
| 340 |
|
|
|