Rajarshi255 commited on
Commit
b6fd649
·
verified ·
1 Parent(s): 79afcf2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -811,6 +811,14 @@ def grade_passage_mode(student_name: str, student_class: str, student_text: str,
811
 
812
  heuristic_bad, heuristic_reason = is_nonsense_heuristic(student_text)
813
  is_failing = is_nonsense_ai or heuristic_bad
 
 
 
 
 
 
 
 
814
 
815
  if mode == "moderate":
816
  max_stars = compute_max_stars_moderate(level)
 
811
 
812
  heuristic_bad, heuristic_reason = is_nonsense_heuristic(student_text)
813
  is_failing = is_nonsense_ai or heuristic_bad
814
+
815
+ # Relevance check: if answer does not resemble passage at all
816
+ if not is_nonsense_ai and not heuristic_bad and raw_score <= 1:
817
+ return (
818
+ "❌ Your answer does not match the passage at all. Please try to recall the actual passage.",
819
+ level,
820
+ ""
821
+ )
822
 
823
  if mode == "moderate":
824
  max_stars = compute_max_stars_moderate(level)