MarkMyPaper is a Flask-based web application for automated grading of handwritten or typed answer submissions. It combines OCR (TrOCR), PDF/image text extraction, and fuzzy text matching to compare student responses against model answers.
- User authentication (register, login, profile, logout)
- JWT-protected API routes
- Password reset token flow
- Upload support for
PDF,JPG,JPEG, andPNG - OCR/text extraction pipeline:
- TrOCR for images
- PyPDF2 for PDFs
- Weighted answer grading using similarity scoring
- Result breakdown per model answer + total score
- Python 3
- Flask, Flask-SQLAlchemy, Flask-CORS
- Transformers (
microsoft/trocr-base-handwritten) - PyTorch
- Pillow, PyPDF2
- TheFuzz (
token_sort_ratio) for grading similarity - SQLite (via SQLAlchemy)
MarkMyPaper/
├── app.py
├── requirements.txt
├── templates/
│ ├── dashboard.html
│ ├── home.html
│ ├── login.html
│ ├── trial.html
│ └── upload.html
└── static/
├── home.css
├── login.css
└── styles.css
git clone https://github.com/DysCreate/MarkMyPaper.git
cd MarkMyPaperpython -m venv .venvWindows (PowerShell):
.\.venv\Scripts\Activate.ps1macOS/Linux:
source .venv/bin/activatepip install -r requirements.txtpython app.pyThe app starts in debug mode at http://127.0.0.1:5000.
On first run, Hugging Face model files for TrOCR are downloaded, so startup may take longer.
POST /api/registerPOST /api/loginGET /api/user(requiresAuthorization: Bearer <token>)POST /api/logout(requires token)POST /api/reset-password-requestPOST /api/reset-password
POST /upload- Form-data fields:
file(PDF/image)answers(repeatable)weights(repeatable)
- Returns extracted text, per-answer similarity/score, and total score
- Form-data fields:
- User data is stored in local SQLite (
instance/users.db). SECRET_KEYis currently hardcoded inapp.py; for production use, move it to an environment variable.- This project is set up for local development and experimentation.
This project is licensed under the MIT License. See LICENSE for details.