Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -104,34 +104,36 @@ def ask_ai(prompt, temperature=0.7, max_retries=2, image=None):
|
|
| 104 |
|
| 105 |
return "⚠️ All AI services failed. Please try again later.", "error"
|
| 106 |
|
| 107 |
-
# ---------- 3.
|
| 108 |
syllabus_topics = {
|
| 109 |
"Primary 6": [
|
| 110 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
"Ratio & Proportion",
|
| 112 |
-
"
|
| 113 |
-
"Volume & Capacity",
|
| 114 |
-
"Angles & Properties of Shapes",
|
| 115 |
-
"Basic Algebra",
|
| 116 |
-
"Data Handling & Statistics",
|
| 117 |
-
"Four Operations (Large Numbers)"
|
| 118 |
],
|
| 119 |
"Primary 7": [
|
| 120 |
-
"
|
| 121 |
-
"
|
| 122 |
-
"
|
| 123 |
-
"
|
| 124 |
-
"
|
| 125 |
-
"
|
|
|
|
|
|
|
| 126 |
"Statistics & Probability",
|
| 127 |
-
"
|
| 128 |
-
"Coordinate Geometry",
|
| 129 |
-
"Ratio, Proportion & Rates"
|
| 130 |
]
|
| 131 |
}
|
| 132 |
|
| 133 |
-
# ---------- 4. Generate Practice Questions (
|
| 134 |
-
def generate_practice_questions(grade_level, topic, num_questions=
|
| 135 |
"""Generate multiple questions with robust text parsing (not JSON)"""
|
| 136 |
|
| 137 |
if not topic:
|
|
|
|
| 104 |
|
| 105 |
return "⚠️ All AI services failed. Please try again later.", "error"
|
| 106 |
|
| 107 |
+
# ---------- 3. Uganda Primary Curriculum Syllabus (P6 & P7 Only) ----------
|
| 108 |
syllabus_topics = {
|
| 109 |
"Primary 6": [
|
| 110 |
+
"Whole Numbers - Addition & Subtraction",
|
| 111 |
+
"Whole Numbers - Multiplication & Division",
|
| 112 |
+
"Fractions & Decimals",
|
| 113 |
+
"Money & Making Change",
|
| 114 |
+
"Measurement - Length, Mass & Capacity",
|
| 115 |
+
"Time & Telling Time",
|
| 116 |
+
"Geometry & Shapes",
|
| 117 |
+
"Data Handling - Graphs & Tables",
|
| 118 |
"Ratio & Proportion",
|
| 119 |
+
"Basic Algebra & Equations"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
],
|
| 121 |
"Primary 7": [
|
| 122 |
+
"Integers & Operations",
|
| 123 |
+
"Fractions - Addition & Subtraction",
|
| 124 |
+
"Fractions - Multiplication & Division",
|
| 125 |
+
"Decimals & Percentages",
|
| 126 |
+
"Ratio, Rate & Proportion",
|
| 127 |
+
"Geometry - Angles & Properties",
|
| 128 |
+
"Mensuration - Area & Perimeter",
|
| 129 |
+
"Volumes & Surface Area",
|
| 130 |
"Statistics & Probability",
|
| 131 |
+
"Algebraic Expressions & Equations"
|
|
|
|
|
|
|
| 132 |
]
|
| 133 |
}
|
| 134 |
|
| 135 |
+
# ---------- 4. Generate Practice Questions (Customizable) ----------
|
| 136 |
+
def generate_practice_questions(grade_level, topic, num_questions=10):
|
| 137 |
"""Generate multiple questions with robust text parsing (not JSON)"""
|
| 138 |
|
| 139 |
if not topic:
|