AI-assisted English answer grading prototype.
This repository is a public demo version of a local tool built to reduce repetitive work in English answer correction. It uses AI to prepare OCR text, draft scoring comments, and write the result back onto a PDF. The final judgment is always left to a human grader.
answer PDF -> OCR draft -> human check -> AI grading draft -> PDF annotation
- Extracts handwritten answer text from PDFs with Gemini.
- Drafts scores and feedback with Claude from a structured master JSON.
- Writes scores and comments back to the answer PDF with PyMuPDF.
- Provides a coordinate picker for mapping PDF answer areas.
- This is a learning/prototype repository, not a production grading service.
- The included data is a small demo set. Real exam materials, real answer sheets, and private grading records are intentionally excluded.
- AI output should be reviewed by a human before being used.
python -m venv .venv
.\.venv\Scripts\activate
pip install -r requirements.txt
copy .env.example .env
copy config.example.json config.jsonThen set the API keys in .env:
GOOGLE_API_KEY=...
ANTHROPIC_API_KEY=...
Create these local folders when needed:
inputs/
step1_texts/
step2_json/
step3_final/
done/
Run OCR:
python step1_mark_and_text_v2.pyReview and edit the generated step1_texts/*_draft.txt, then run grading and PDF output:
python step2_and3_combined.pyTo register coordinates for a new answer sheet layout:
python coordinate_picker.pydata/
coord_db/ demo coordinate data
masters/ demo scoring master JSON
prompts/ grading system prompt
rubric_txts/ demo rubric text
step1_mark_and_text_v2.py
step2_and3_combined.py
coordinate_picker.py
preprocessing.py
Runtime folders such as inputs/, done/, step1_texts/, and step3_final/ are ignored by Git.