Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -364,7 +364,7 @@ Start immediately with Q1. Do not include any introduction or explanation.
|
|
| 364 |
|
| 365 |
# ---------- 5. Grade/Mark Student Answers ----------
|
| 366 |
def grade_student_answers(questions, student_answers, grade_level, topic, subject=None):
|
| 367 |
-
"""Grade all student answers and provide feedback"""
|
| 368 |
|
| 369 |
if not questions or not student_answers:
|
| 370 |
return " No questions or answers to grade."
|
|
@@ -378,20 +378,20 @@ def grade_student_answers(questions, student_answers, grade_level, topic, subjec
|
|
| 378 |
feedback_list.append(f"Q{i+1}: [NOT ANSWERED]")
|
| 379 |
continue
|
| 380 |
|
| 381 |
-
# Create grading prompt
|
| 382 |
grading_prompt = f"""You are an experienced UNEB examiner for {grade_level} students. Subject: {subject or 'General'}
|
| 383 |
-
|
| 384 |
-
Question: {question_text}
|
| 385 |
|
| 386 |
Student's Answer: {student_answer}
|
| 387 |
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
|
| 394 |
-
|
| 395 |
|
| 396 |
grade_response, _ = ask_ai(grading_prompt, temperature=0.3)
|
| 397 |
feedback_list.append(f"Q{i+1}:\n{grade_response}\n")
|
|
|
|
| 364 |
|
| 365 |
# ---------- 5. Grade/Mark Student Answers ----------
|
| 366 |
def grade_student_answers(questions, student_answers, grade_level, topic, subject=None):
|
| 367 |
+
"""Grade all student answers and provide AI feedback - NO STRICT FORMAT REQUIRED"""
|
| 368 |
|
| 369 |
if not questions or not student_answers:
|
| 370 |
return " No questions or answers to grade."
|
|
|
|
| 378 |
feedback_list.append(f"Q{i+1}: [NOT ANSWERED]")
|
| 379 |
continue
|
| 380 |
|
| 381 |
+
# Create flexible grading prompt - AI evaluates based on question number & content
|
| 382 |
grading_prompt = f"""You are an experienced UNEB examiner for {grade_level} students. Subject: {subject or 'General'}
|
| 383 |
+
|
| 384 |
+
Question {i+1}: {question_text}
|
| 385 |
|
| 386 |
Student's Answer: {student_answer}
|
| 387 |
|
| 388 |
+
Evaluate this answer:
|
| 389 |
+
- Is it correct, partially correct, or incorrect?
|
| 390 |
+
- Provide a mark/score
|
| 391 |
+
- Give feedback explaining what's good and what needs improvement
|
| 392 |
+
- If incorrect, briefly explain the correct approach
|
| 393 |
|
| 394 |
+
Accept answers in ANY format/style as long as they address the question. Be constructive and encouraging."""
|
| 395 |
|
| 396 |
grade_response, _ = ask_ai(grading_prompt, temperature=0.3)
|
| 397 |
feedback_list.append(f"Q{i+1}:\n{grade_response}\n")
|