Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -161,38 +161,7 @@ def generate_question(subject, difficulty, question_type):
|
|
| 161 |
logger.debug(f"Selected topic: {selected_topic}")
|
| 162 |
|
| 163 |
difficulty_params = get_difficulty_parameters(difficulty)
|
| 164 |
-
|
| 165 |
-
if question_type == "application":
|
| 166 |
-
application_addition = """
|
| 167 |
-
The application question MUST:
|
| 168 |
-
- Present a real-world scenario or practical problem
|
| 169 |
-
- Require modeling the situation mathematically
|
| 170 |
-
- Connect abstract mathematical concepts to concrete situations
|
| 171 |
-
- Include realistic context and data
|
| 172 |
-
- Require students to:
|
| 173 |
-
1. Identify relevant mathematical concepts
|
| 174 |
-
2. Translate the practical problem into mathematical terms
|
| 175 |
-
3. Solve using appropriate mathematical techniques
|
| 176 |
-
4. Interpret the results in the context of the original problem
|
| 177 |
-
|
| 178 |
-
Example contexts might include:
|
| 179 |
-
- Physics applications (motion, forces, work)
|
| 180 |
-
- Engineering scenarios (optimization, rates of change)
|
| 181 |
-
- Economics problems (cost optimization, growth models)
|
| 182 |
-
- Biological systems (population growth, reaction rates)
|
| 183 |
-
- Business applications (profit maximization, inventory management)
|
| 184 |
-
- Social science applications (demographic models, social network analysis)
|
| 185 |
-
- Data science applications (regression, statistical analysis)
|
| 186 |
-
"""
|
| 187 |
-
if question_type == "proof":
|
| 188 |
-
proof_addition = """
|
| 189 |
-
The proof question MUST:
|
| 190 |
-
- Require a formal mathematical proof
|
| 191 |
-
- Ask to prove the truth of a mathematical statement
|
| 192 |
-
- Focus on demonstrating logical reasoning
|
| 193 |
-
- Require justification for each step
|
| 194 |
-
- Emphasize theoretical understanding
|
| 195 |
-
"""
|
| 196 |
if difficulty == 5:
|
| 197 |
system_prompt = f"""You are an expert mathematics professor creating a graduate-level exam question.
|
| 198 |
STRICT REQUIREMENTS:
|
|
@@ -208,8 +177,6 @@ STRICT REQUIREMENTS:
|
|
| 208 |
|
| 209 |
Follow these specific constraints:
|
| 210 |
{chr(10).join(f' - {c}' for c in difficulty_params['constraints'])}
|
| 211 |
-
{application_addition}
|
| 212 |
-
{proof_addition}
|
| 213 |
3. Style Reference:
|
| 214 |
Question should be {difficulty_params['example_style']}
|
| 215 |
4. The question MUST:
|
|
@@ -235,8 +202,6 @@ STRICT REQUIREMENTS:
|
|
| 235 |
{difficulty_params['description'].upper()}
|
| 236 |
Follow these specific constraints:
|
| 237 |
{chr(10).join(f' - {c}' for c in difficulty_params['constraints'])}
|
| 238 |
-
{application_addition}
|
| 239 |
-
{proof_addition}
|
| 240 |
3. Style Reference:
|
| 241 |
Question should be {difficulty_params['example_style']}
|
| 242 |
4. For LaTeX formatting:
|
|
|
|
| 161 |
logger.debug(f"Selected topic: {selected_topic}")
|
| 162 |
|
| 163 |
difficulty_params = get_difficulty_parameters(difficulty)
|
| 164 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
if difficulty == 5:
|
| 166 |
system_prompt = f"""You are an expert mathematics professor creating a graduate-level exam question.
|
| 167 |
STRICT REQUIREMENTS:
|
|
|
|
| 177 |
|
| 178 |
Follow these specific constraints:
|
| 179 |
{chr(10).join(f' - {c}' for c in difficulty_params['constraints'])}
|
|
|
|
|
|
|
| 180 |
3. Style Reference:
|
| 181 |
Question should be {difficulty_params['example_style']}
|
| 182 |
4. The question MUST:
|
|
|
|
| 202 |
{difficulty_params['description'].upper()}
|
| 203 |
Follow these specific constraints:
|
| 204 |
{chr(10).join(f' - {c}' for c in difficulty_params['constraints'])}
|
|
|
|
|
|
|
| 205 |
3. Style Reference:
|
| 206 |
Question should be {difficulty_params['example_style']}
|
| 207 |
4. For LaTeX formatting:
|