Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -804,7 +804,7 @@ def append_chatgpt_verification(initial_response, SYMPY_CONFIRMED, final_verific
|
|
| 804 |
logger.error(f"Error in verification process: {str(e)}")
|
| 805 |
return initial_response + f"\n\nError in ChatGPT verification: {str(e)}"
|
| 806 |
|
| 807 |
-
def generate_question(subject, difficulty, question_type, subtopic, use_enhancement=False, include_chatgpt="no"):
|
| 808 |
"""Generate a single math question with additional verification"""
|
| 809 |
try:
|
| 810 |
logger.debug(f"ChatGPT verification: {'enabled' if include_chatgpt == 'yes' else 'disabled'}")
|
|
@@ -1308,16 +1308,11 @@ Remember to write out the complete solution even if you are repeating things fro
|
|
| 1308 |
def update_subtopics(subject):
|
| 1309 |
logger.debug(f"update_subtopics called with subject: {subject}")
|
| 1310 |
if subject in SUBJECT_SUBTOPICS:
|
| 1311 |
-
|
| 1312 |
-
|
| 1313 |
-
|
| 1314 |
-
visible=True
|
| 1315 |
-
)
|
| 1316 |
logger.debug("No subtopics found for subject")
|
| 1317 |
-
return gr.Dropdown
|
| 1318 |
-
choices=[],
|
| 1319 |
-
visible=False
|
| 1320 |
-
)
|
| 1321 |
|
| 1322 |
# Create Gradio interface
|
| 1323 |
with gr.Blocks() as interface:
|
|
@@ -1328,22 +1323,11 @@ with gr.Blocks() as interface:
|
|
| 1328 |
with gr.Row():
|
| 1329 |
with gr.Column():
|
| 1330 |
subject_dropdown = gr.Dropdown(
|
| 1331 |
-
choices=
|
| 1332 |
-
"Single Variable Calculus",
|
| 1333 |
-
"Multivariable Calculus",
|
| 1334 |
-
"Linear Algebra",
|
| 1335 |
-
"Differential Equations",
|
| 1336 |
-
"Real Analysis",
|
| 1337 |
-
"Complex Analysis",
|
| 1338 |
-
"Abstract Algebra",
|
| 1339 |
-
"Probability Theory",
|
| 1340 |
-
"Numerical Analysis",
|
| 1341 |
-
"Topology"
|
| 1342 |
-
],
|
| 1343 |
label="Select Mathematics Subject",
|
| 1344 |
info="Choose a subject for the question"
|
| 1345 |
)
|
| 1346 |
-
|
| 1347 |
# Add this after subject_dropdown
|
| 1348 |
subtopic_dropdown = gr.Dropdown(
|
| 1349 |
choices=[], # Empty initially
|
|
|
|
| 804 |
logger.error(f"Error in verification process: {str(e)}")
|
| 805 |
return initial_response + f"\n\nError in ChatGPT verification: {str(e)}"
|
| 806 |
|
| 807 |
+
def generate_question(subject, difficulty, question_type, subtopic=None, use_enhancement=False, include_chatgpt="no"):
|
| 808 |
"""Generate a single math question with additional verification"""
|
| 809 |
try:
|
| 810 |
logger.debug(f"ChatGPT verification: {'enabled' if include_chatgpt == 'yes' else 'disabled'}")
|
|
|
|
| 1308 |
def update_subtopics(subject):
|
| 1309 |
logger.debug(f"update_subtopics called with subject: {subject}")
|
| 1310 |
if subject in SUBJECT_SUBTOPICS:
|
| 1311 |
+
choices = SUBJECT_SUBTOPICS[subject]
|
| 1312 |
+
logger.debug(f"Found subtopics: {choices}")
|
| 1313 |
+
return gr.Dropdown(choices=choices, visible=True)
|
|
|
|
|
|
|
| 1314 |
logger.debug("No subtopics found for subject")
|
| 1315 |
+
return gr.Dropdown(choices=[], visible=False)
|
|
|
|
|
|
|
|
|
|
| 1316 |
|
| 1317 |
# Create Gradio interface
|
| 1318 |
with gr.Blocks() as interface:
|
|
|
|
| 1323 |
with gr.Row():
|
| 1324 |
with gr.Column():
|
| 1325 |
subject_dropdown = gr.Dropdown(
|
| 1326 |
+
choices=list(SUBJECT_SUBTOPICS.keys()), # Use dictionary keys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1327 |
label="Select Mathematics Subject",
|
| 1328 |
info="Choose a subject for the question"
|
| 1329 |
)
|
| 1330 |
+
|
| 1331 |
# Add this after subject_dropdown
|
| 1332 |
subtopic_dropdown = gr.Dropdown(
|
| 1333 |
choices=[], # Empty initially
|