mikaelJ46 commited on
Commit
e7dd03b
·
verified ·
1 Parent(s): 730e058

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
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
- Provide:
389
- 1. Is this answer correct? (Yes/Partially/No)
390
- 2. Score: X/10
391
- 3. Explanation: Brief feedback on what's correct and what needs improvement
392
- 4. If wrong, provide the correct approach
393
 
394
- Keep feedback concise but clear. Be encouraging."""
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")