Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
# app.py
|
2 |
import gradio as gr
|
3 |
-
from tool2 import *
|
4 |
from backend1 import *
|
5 |
|
6 |
# Global variable to store the currently selected set of exam questions
|
@@ -21,7 +21,7 @@ def start_exam(exam_choice, start_question, audio_enabled):
|
|
21 |
if not selected_questions: # Handle case where no questions are loaded for selected exam
|
22 |
return (
|
23 |
gr.update(visible=True), # Show title
|
24 |
-
gr.update(value="**Error: No Questions Found**", visible=True), # Update description to error message
|
25 |
gr.update(visible=True), # Show exam_selector
|
26 |
gr.update(visible=True), # Show start_button
|
27 |
gr.update(visible=True), # Show the audio_checkbox
|
@@ -216,8 +216,8 @@ with gr.Blocks() as demo:
|
|
216 |
|
217 |
# Connect the quiz buttons to their functions
|
218 |
answer_button.click(fn=handle_answer, inputs=[question_state, choices, audio_checkbox, current_audio_state], outputs=[result_text, answer_audio, current_audio_state])
|
219 |
-
next_button.click(fn=handle_next, inputs=[question_state,
|
220 |
-
prev_button.click(fn=handle_previous, inputs=[question_state,
|
221 |
|
222 |
explain_button.click(fn=show_explanation, inputs=[question_state], outputs=[explanation_text, result_text, explanation_text]) # Corrected output to explanation_text for the last element which was incorrectly result_text
|
223 |
|
|
|
1 |
# app.py
|
2 |
import gradio as gr
|
3 |
+
from tool2 import * # Make sure this is tool2, and tool2.py is updated with correct code
|
4 |
from backend1 import *
|
5 |
|
6 |
# Global variable to store the currently selected set of exam questions
|
|
|
21 |
if not selected_questions: # Handle case where no questions are loaded for selected exam
|
22 |
return (
|
23 |
gr.update(visible=True), # Show title
|
24 |
+
gr.update(value="**Error: No Questions Found for this Exam**", visible=True), # Update description to error message
|
25 |
gr.update(visible=True), # Show exam_selector
|
26 |
gr.update(visible=True), # Show start_button
|
27 |
gr.update(visible=True), # Show the audio_checkbox
|
|
|
216 |
|
217 |
# Connect the quiz buttons to their functions
|
218 |
answer_button.click(fn=handle_answer, inputs=[question_state, choices, audio_checkbox, current_audio_state], outputs=[result_text, answer_audio, current_audio_state])
|
219 |
+
next_button.click(fn=handle_next, inputs=[question_state, audio_enabled], outputs=[question_text, choices, question_state, result_text, question_audio, explanation_text, result_text]) # Added result_text to clear on next
|
220 |
+
prev_button.click(fn=handle_previous, inputs=[question_state, audio_enabled], outputs=[question_text, choices, question_state, result_text, question_audio, explanation_text, result_text]) # Added result_text to clear on prev
|
221 |
|
222 |
explain_button.click(fn=show_explanation, inputs=[question_state], outputs=[explanation_text, result_text, explanation_text]) # Corrected output to explanation_text for the last element which was incorrectly result_text
|
223 |
|