Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -729,7 +729,25 @@ def create_quiz_interface():
|
|
729 |
f"Question {new_idx + 1} of {len(questions)}",
|
730 |
gr.update(visible=True)
|
731 |
]
|
|
|
|
|
732 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
733 |
|
734 |
def on_submit(questions, answers, current_idx, current_answer):
|
735 |
"""Handle quiz submission with proper HTML rendering"""
|
|
|
729 |
f"Question {new_idx + 1} of {len(questions)}",
|
730 |
gr.update(visible=True)
|
731 |
]
|
732 |
+
def handle_prev(current_idx, questions, answers, current_answer):
|
733 |
+
return navigate(-1, current_idx, questions, answers, current_answer)
|
734 |
|
735 |
+
def handle_next(current_idx, questions, answers, current_answer):
|
736 |
+
return navigate(1, current_idx, questions, answers, current_answer)
|
737 |
+
|
738 |
+
def update_answer_state(answer, idx, current_answers):
|
739 |
+
new_answers = list(current_answers)
|
740 |
+
if 0 <= idx < len(new_answers):
|
741 |
+
new_answers[idx] = answer
|
742 |
+
return new_answers
|
743 |
+
|
744 |
+
def reset_quiz(text, num_questions):
|
745 |
+
"""Handle quiz reset"""
|
746 |
+
return on_generate_questions(text, num_questions)
|
747 |
+
|
748 |
+
def view_certificate():
|
749 |
+
"""Navigate to certificate tab"""
|
750 |
+
return gr.Tabs(selected=2)
|
751 |
|
752 |
def on_submit(questions, answers, current_idx, current_answer):
|
753 |
"""Handle quiz submission with proper HTML rendering"""
|