Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -31,7 +31,6 @@ def start_exam(exam_choice, start_question, audio_enabled):
|
|
31 |
gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), start_question, "", audio_path, gr.update(visible=True),
|
32 |
gr.update(visible=True), None # None for the audio stop signal
|
33 |
)
|
34 |
-
|
35 |
|
36 |
def display_question(index, audio_enabled):
|
37 |
"""Displays a question with options and generates audio (if enabled)."""
|
@@ -168,17 +167,13 @@ with gr.Blocks() as demo:
|
|
168 |
fn=start_exam,
|
169 |
inputs=[exam_selector, start_question_slider, audio_checkbox],
|
170 |
outputs=[
|
171 |
-
title, description, exam_selector,
|
172 |
-
|
173 |
question_text, question_text, choices, answer_button,
|
174 |
next_button, prev_button, home_button, question_state, result_text, question_audio,
|
175 |
-
explain_button, current_audio_state
|
176 |
-
gr.update(visible=False) # Hide the start_question_slider
|
177 |
]
|
178 |
)
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
|
183 |
# Connect the quiz buttons to their functions
|
184 |
answer_button.click(fn=handle_answer, inputs=[question_state, choices, audio_checkbox, current_audio_state], outputs=[result_text, answer_audio, current_audio_state])
|
|
|
31 |
gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), start_question, "", audio_path, gr.update(visible=True),
|
32 |
gr.update(visible=True), None # None for the audio stop signal
|
33 |
)
|
|
|
34 |
|
35 |
def display_question(index, audio_enabled):
|
36 |
"""Displays a question with options and generates audio (if enabled)."""
|
|
|
167 |
fn=start_exam,
|
168 |
inputs=[exam_selector, start_question_slider, audio_checkbox],
|
169 |
outputs=[
|
170 |
+
title, description, exam_selector, start_button,
|
171 |
+
audio_checkbox, # Ensure the checkbox visibility is updated
|
172 |
question_text, question_text, choices, answer_button,
|
173 |
next_button, prev_button, home_button, question_state, result_text, question_audio,
|
174 |
+
explain_button, current_audio_state # Add current_audio_state to the outputs
|
|
|
175 |
]
|
176 |
)
|
|
|
|
|
|
|
177 |
|
178 |
# Connect the quiz buttons to their functions
|
179 |
answer_button.click(fn=handle_answer, inputs=[question_state, choices, audio_checkbox, current_audio_state], outputs=[result_text, answer_audio, current_audio_state])
|