How jose-0000/exam-grading-assistant works
Project Type and Purpose
• This is a full-stack web application (“Exam Grading Assistant”) built with Python/Flask on the backend and plain HTML/CSS/JS on the frontend.
• Purpose: Automate grading of handwritten exam scripts by applying image preprocessing, OCR extraction, and semantic similarity scoring (via BERT).
File Structure Analysis
• Top level:
• app.py, main.py – Flask routing and server startup
• grading.py – BERT-based grading logic
• imagepre.py, image.py – image preprocessing functions (resizing, contrast/brightness adjust)
• ocr_utils.py – OCR wrapper (PyTesseract calls)
• templates/ – HTML views (front.html, index.html, result.html)
• .env, requirements.txt – configuration and dependency listing
• No dedicated static/ uploads/ processed/ dirs shown, but implied by README.
• No microservices or external API servers—single-process Flask app.
README Insights
• Confirms tech stack (Flask, OpenCV, Pillow, PyTesseract, Tesseract-OCR, BERT).
• High-level workflow: upload → preprocess → OCR → BERT similarity → render result.
Main Components
a. Client Layer
• Client Browser
• Renders front.html, index.html, result.html
b. Backend Layer (Flask Server)
• Routes & Controllers (app.py / main.py)
• Configuration (env variables, requirements.txt)
• Service Modules:
• Image Preprocessor (imagepre.py, image.py)
• OCR Module (ocr_utils.py)
• Grading Module (grading.py)
c. Storage
• Uploaded images directory
• Processed images directory
d. External Engine
• Tesseract-OCR binary
• BERT model (could be local or loaded via a Python library)
Component Interactions
• Client → POST image → Routes
• Routes → Image Preprocessor → enhanced image
• Preprocessor → OCR Module → extracted text
• OCR Module → Grading Module → similarity scores
• Grading Module → Routes → render result.html back to Client
• Routes → Save raw / processed images to Storage
Architectural Patterns & Design Principles
• Layered architecture (Presentation, Application Logic, Services, Storage)
• Separation of concerns: distinct modules for preprocessing, OCR, grading
• Single‐process monolith (no microservices)
• Standard MVC-style routing & templating (Flask controllers → Jinja2 templates)
Technologies & Frameworks
• Flask (HTTP routing, templating)
• Pillow & OpenCV (image manipulation)
• PyTesseract + Tesseract-OCR (text extraction)
• BERT (semantic similarity scoring, grading)
• HTML/CSS/JS (UI)