Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,6 @@ import os
|
|
| 9 |
from pathlib import Path
|
| 10 |
import time
|
| 11 |
|
| 12 |
-
# NOTE: No changes were made to your prompts or rubric.
|
| 13 |
GRADING_RUBRIC = """
|
| 14 |
GRADING RUBRIC (Total 100 points)
|
| 15 |
|
|
@@ -168,6 +167,19 @@ class GeminiGrader:
|
|
| 168 |
feedback=data["feedback"],
|
| 169 |
summary=data["summary"]
|
| 170 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
except Exception as e:
|
| 172 |
print(f"[DEBUG] !!! An error occurred in grade_essay: {e}")
|
| 173 |
return GradingResult(
|
|
|
|
| 9 |
from pathlib import Path
|
| 10 |
import time
|
| 11 |
|
|
|
|
| 12 |
GRADING_RUBRIC = """
|
| 13 |
GRADING RUBRIC (Total 100 points)
|
| 14 |
|
|
|
|
| 167 |
feedback=data["feedback"],
|
| 168 |
summary=data["summary"]
|
| 169 |
)
|
| 170 |
+
except json.JSONDecodeError as e:
|
| 171 |
+
print("\n" + "="*20 + " JSON PARSE ERROR " + "="*20)
|
| 172 |
+
print(f"[DEBUG] The model returned a malformed JSON. Error: {e}")
|
| 173 |
+
print("[DEBUG] --- FAULTY RESPONSE FROM MODEL ---")
|
| 174 |
+
print(cleaned_response)
|
| 175 |
+
print("[DEBUG] --- END OF FAULTY RESPONSE ---")
|
| 176 |
+
print("="*58 + "\n")
|
| 177 |
+
return GradingResult(
|
| 178 |
+
file_name=student_paper_file.display_name,
|
| 179 |
+
success=False,
|
| 180 |
+
error_message=f"Model returned malformed JSON. Details: {e}"
|
| 181 |
+
)
|
| 182 |
+
|
| 183 |
except Exception as e:
|
| 184 |
print(f"[DEBUG] !!! An error occurred in grade_essay: {e}")
|
| 185 |
return GradingResult(
|