Skip to content

AI-powered exam grading assistant that supports OpenAI-compatible APIs (with custom base URL) and Google Gemini. Features automated handwritten exam evaluation with OCR, detailed reporting, and a manual review interface. For educational use only.

License

Notifications You must be signed in to change notification settings

FIELA/AIExamGrader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

AI Exam Grader

License: Non-Commercial Python 3.10+ Code Style: Black

English | ็ฎ€ไฝ“ไธญๆ–‡


๐Ÿ“– Introduction

AI Exam Grader is an intelligent grading assistant powered by Large Language Models (LLMs), designed for teachers and educators. It leverages the visual understanding capabilities of OpenAI (GPT-4o) or Google Gemini (Pro) to automatically grade handwritten exam papers and generate detailed reports.

Important

License Notice

This project is licensed under the NCEL-Strict License (Version 2.0). This is a Source Available but Strictly Limited non-commercial license.

๐Ÿšซ Commercial Use Strictly Prohibited: Includes sale, subscription, sponsorship, Internal Use, SaaS services, and AI model training.
๐Ÿšซ Distribution of Modified Versions Prohibited: You may NOT directly distribute modified source code or binaries (only Patch/Diff files are allowed).
๐Ÿšซ Fork Restriction: Public Forks are allowed ONLY for submitting PRs and must be deleted within 14 days after the PR is closed.
โœ… Non-Commercial Only: Personal study, academic research, and non-commercial use must retain the full copyright notice and license file.

๐Ÿ’ผ Commercial License: For commercial use or custom development, please contact the author for licensing: nicofiela@outlook.com

โœจ Features

  • ๐Ÿค– Intelligent Grading Engine

    • Multi-Model Support:
      • Supports OpenAI (GPT-4o, etc.) and compatible APIs (Custom Base URL)
      • Supports Google Gemini (gemini-3.0-pro, etc.)
    • Smart OCR Recognition: Automatically extracts handwritten student names, IDs, and class information
    • Flexible Grading Rubrics: Supports custom rubrics for precise subjective question grading
    • Batch Concurrent Processing: Multi-threaded architecture for high-speed grading of large batches

    [!NOTE] This application relies heavily on the model's visual understanding and reasoning capabilities. For best results, we recommend using more powerful models (e.g., GPT-4o, Gemini 3.0 Pro).

  • ๐Ÿ“Š Smart Data Management

    • Chain auto-validation (Answer Key โ†’ Layout โ†’ CSV)
    • Automatic CSV rebuild when missing
    • Incremental processing with resume capability
    • Seamless CN/EN directory support
  • ๐Ÿ” Manual Review System

    • Three-step review process (Info โ†’ Objective โ†’ Subjective)
    • Dual-mode viewing (Text/Image)
    • Smart navigation and search
    • Complete review history tracking
  • ๐Ÿ“‹ Comprehensive Reports + ๐ŸŒ Internationalization

    • Markdown reports + Enhanced CSV + Structured JSON
    • Full Chinese-English support
    • Quick-switch configuration profiles

๐Ÿš€ Quick Start

1. Requirements

  • macOS (Recommended) / Windows / Linux
  • Python 3.10+

2. Install Dependencies

pip install -r requirements.txt

3. Configure Application

Method 1: Using Configuration Profiles (Recommended)

Copy the example configuration file:

cp config_example.json config.json

Edit config.json with your actual API keys and file paths.

Method 2: Manual Configuration

You can also configure settings directly in the application interface.

See README_CONFIG.md for detailed configuration guide.

4. Run Application

python AutoGrader.py

5. Build App (Optional)

macOS:

python build.py

The .app bundle will be generated in the dist/ folder.

Windows:

python build_windows.py

The executable (.exe) will be generated in the dist/ folder.

๐Ÿ› ๏ธ Usage Guide

Quick Workflow (5 Steps)

Step 1: Configure API

API Settings
โ”œโ”€ API Key: Enter your API key
โ”œโ”€ Service Provider: OpenAI / Gemini
โ”œโ”€ Model Name: gpt-4o / gemini-1.5-pro
โ””โ”€ Base URL: (Optional)

Step 2: Upload Resources

Resource Files
โ”œโ”€ ๐Ÿ“„ Rubric: Upload exam questions and answers document
โ”œโ”€ ๐Ÿ“ Answer Sheets Folder: Select folder containing scanned images
โ””โ”€ ๐Ÿ‘ฅ Student List: (Optional) Upload Excel/CSV student roster

Step 3: Start Grading

Click "Start Grading" button

Automated Flow:

Check Answer Key โ†’ Confirm Answers โ†’ Detect Layout โ†’ Confirm Layout โ†’ Generate CSV โ†’ Start Grading

User Interaction Points:

  • ๐Ÿ” Answer Key Confirmation: Confirm AI-extracted answers on first run
  • ๐Ÿ” Layout Description Confirmation: Confirm answer sheet structure on first run

Step 4: Manual Review

After grading completes, click "Review" button

Three-Step Review Process:

Step 1: Verify Student Information
Step 2: Verify Objective Questions
Step 3: Verify Subjective Question Scores

Quick Actions:

  • ๐Ÿ“/๐Ÿ–ผ Toggle Text/Image Mode
  • โฌ…๏ธ/โžก๏ธ Previous/Next Student
  • ๐Ÿ” Search Student (Name/ID)
  • โœ… Confirm and Continue

Step 5: Export Results

Output File Locations
โ”œโ”€ ๐Ÿ“Š Grade_Summary.csv (in grading_data/ folder)
โ”œโ”€ ๐Ÿ“ Grading_Report.md (in reports/ folder, one per student)
โ””โ”€ ๐Ÿ“„ Student_Data.json (in reports/ folder, one per student)

Directory Structure (Auto-Generated)

When you start grading, the application automatically creates:

Answer Sheets Folder/
โ”œโ”€ grading_data/              # Configuration and summary data
โ”‚   โ”œโ”€ answer_key.json       # Standard answers
โ”‚   โ”œโ”€ layout_config.json    # Answer sheet layout
โ”‚   โ””โ”€ Grade_Summary.csv     # Grade summary table
โ”‚
โ”œโ”€ reports/                   # Grading results
โ”‚   โ”œโ”€ 01-01.json           # Student grade data
โ”‚   โ”œโ”€ 01-01.md             # Student grading report
โ”‚   โ””โ”€ ...
โ”‚
โ”œโ”€ original_files/           # Original answer sheet backups
โ”‚   โ””โ”€ *.jpg/png
โ”‚
โ”œโ”€ success/                  # Successfully graded sheets
โ”‚   โ””โ”€ *.jpg/png
โ”‚
โ””โ”€ failed/                   # Failed grading attempts
    โ””โ”€ *.jpg/png

Data Validation Flow

Start Grading โ†’ Answer Key โ†’ Layout Config โ†’ CSV File โ†’ File Integrity โ†’ Begin Grading
     โ†“             โ†“            โ†“             โ†“            โ†“              โ†“
Basic Check   Smart Extract  Auto-Detect  Smart Recovery  Incremental  Batch Process

Key Features:

  • โœ… Chain Validation: Answer Key โ†’ Layout โ†’ CSV โ†’ Grading
  • โœ… Smart Recovery: Automatically rebuilds CSV from JSON if missing
  • โœ… Incremental Processing: Only grades incomplete files
  • โœ… Auto Migration: Legacy files automatically moved to new structure
  • โœ… User Confirmation: Answer key and layout require user approval
  • โœ… Data Consistency: Rebuilds CSV after grading to ensure accuracy

Output Files Explained

Grade Summary (CSV)
Contains complete grades and information for all students

  • Basic Info: Room, Seat, Name, ID, Class
  • Scores: Total, Objective, Subjective, Individual Questions
  • OCR Info: Recognized name, ID, etc.
  • Review Status: Unreviewed/Reviewed/Second Review

Grading Report (Markdown)
Detailed grading report for each student

  • Student information verification
  • Objective question answer comparison table
  • Subjective question analysis for each question
  • Total score statistics

Grade Data (JSON)
Structured data containing all grading details

  • Used for data recovery
  • Supports secondary development
  • Review history records

Best Practices

Before Grading

  • โœ… Prepare high-resolution scanned answer sheets
  • โœ… Prepare complete rubric document
  • โœ… Check API quota is sufficient

During Grading

  • โœ… Maintain stable network connection
  • โœ… Do not close the application window
  • โœ… Monitor progress and logs

During Review

  • โœ… Verify each student's information individually
  • โœ… Focus on checking subjective question scores
  • โœ… Use search function to quickly locate students

After Completion

  • โœ… Export CSV to a safe location
  • โœ… Backup the grading data folder
  • โœ… Verify CSV row count matches student count

๐Ÿ“‚ Project Structure

AIExamGrader/
โ”œโ”€โ”€ AutoGrader.py           # Main application
โ”œโ”€โ”€ config_manager.py       # Configuration management
โ”œโ”€โ”€ student_manager.py      # Student database management
โ”œโ”€โ”€ grader_engine.py        # AI grading engine
โ”œโ”€โ”€ review_window.py        # Manual review interface
โ”œโ”€โ”€ standard_answer_dialog.py # Standard answer configuration
โ”œโ”€โ”€ splash_screen.py        # Application splash screen
โ”œโ”€โ”€ translations.py         # Internationalization
โ”œโ”€โ”€ utils.py                # Helper functions
โ”œโ”€โ”€ tooltip.py              # Tooltip widget
โ”œโ”€โ”€ theme.py                # UI Theme definitions
โ”œโ”€โ”€ generate_icon.py        # Icon generation script
โ”œโ”€โ”€ config_example.json     # Example configuration
โ”œโ”€โ”€ README_CONFIG.md        # Configuration guide
โ”œโ”€โ”€ requirements.txt        # Dependencies
โ”œโ”€โ”€ rthook_google.py        # PyInstaller runtime hook
โ”œโ”€โ”€ build.py                # macOS build script
โ”œโ”€โ”€ build_windows.py        # Windows build script
โ”œโ”€โ”€ test_core.py            # Core functionality tests
โ””โ”€โ”€ test_review_logs.py     # Review log tests

๐Ÿ”ง Configuration Files

  • config.json: Main configuration file (created from config_example.json)
  • config_example.json: Example configuration with sample profiles
  • See README_CONFIG.md for detailed configuration documentation

๐Ÿค Contributing

Contributions are welcome! Please read CONTRIBUTING.md for details.

๐Ÿ“„ License

This project is licensed under the NCEL-Strict License (Version 2.0) - see the LICENSE file for details.

For commercial use, please contact the project author for licensing options: nicofiela@outlook.com


Made with โค๏ธ for educators worldwide

About

AI-powered exam grading assistant that supports OpenAI-compatible APIs (with custom base URL) and Google Gemini. Features automated handwritten exam evaluation with OCR, detailed reporting, and a manual review interface. For educational use only.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages