Autonomous AI-powered grading system to reduce TA workload by automatically grading student submissions from handwritten PDFs.
π Visit our website | π Join the waitlist
TAI (Teaching Assistant Intelligence) is a Next.js application that automates the grading process for educational assignments. It uses multi-engine OCR to extract handwritten work from PDFs, Claude AI to grade submissions based on rubrics, and provides a comprehensive interface for both instructors and students.
- Multi-Engine OCR: Extract handwritten answers from PDFs using Claude, PaddleOCR, Pix2Text, and Surya
- AI-Powered Grading: Automated grading using Claude Sonnet 4.5 with rubric-based assessment
- Dual-Mode Interface:
- TA/Instructor view: Create assignments, manage rubrics, review submissions
- Student view: Submit work, view grades and feedback
- Consensus Algorithm: Multiple OCR engines work together for higher accuracy
- Solution Key Extraction: Automatically parse solution PDFs to create answer keys
- Real-time Feedback: Detailed per-question feedback for students
- Frontend: Next.js 16, React 19, TypeScript, Tailwind CSS
- UI Components: Radix UI, Shadcn/ui
- AI/ML: Anthropic Claude API, multiple OCR engines
- Infrastructure: Docker (OCR services), Redis (caching)
- Charts: Recharts for analytics visualization
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Next.js Application β
β βββββββββββββββββββ ββββββββββββββββ βββββββββββββββββ β
β β TA Interface β β Student β β Server β β
β β - Create β β Interface β β Actions β β
β β - Review β β - Submit β β - Grading β β
β β - Analytics β β - View β β - OCR β β
β βββββββββββββββββββ ββββββββββββββββ βββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β In-Memory Database β
β Courses β Assignments β Submissions β Rubrics β Students β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββΌββββββββββββββββββββ
βΌ βΌ βΌ
ββββββββββββββββββββ βββββββββββββββ ββββββββββββββββββββ
β Claude API β β OCR Servicesβ β Redis Cache β
β - Grading β β - PaddleOCR β β - Results β
β - Extraction β β - Pix2Text β β - Jobs β
β - Rubrics β β - Surya β β β
ββββββββββββββββββββ βββββββββββββββ ββββββββββββββββββββ
- Node.js 18+ and npm/yarn/pnpm
- Docker and Docker Compose (for OCR services)
- Anthropic API key
-
Clone the repository
git clone <repository-url> cd tai
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env.local
Add your API keys to
.env.local:ANTHROPIC_API_KEY=your_anthropic_api_key # Optional: Other OCR service keys MATHPIX_APP_ID=your_mathpix_app_id MATHPIX_APP_KEY=your_mathpix_app_key
-
Start OCR services (optional but recommended)
cd ocr-services docker-compose up -dThis starts:
- PaddleOCR service on port 8001
- Pix2Text service on port 8002
- Surya service on port 8003
- Redis on port 6379
-
Run the development server
npm run dev
-
Open the application Navigate to http://localhost:3000
-
Create Assignment
- Upload problem set PDF
- AI extracts rubric or create custom rubric
- Set point values and grading criteria
-
Add Solution Key
- Upload solution PDF
- AI extracts answers
- Review and confirm
-
Review Submissions
- View auto-graded submissions
- Adjust grades if needed
- Release grades to students
-
View Assignments
- See all available assignments
- Check due dates and requirements
-
Submit Work
- Upload PDF of handwritten work
- Wait for automatic grading
-
View Results
- See total score
- Review per-question feedback
- Understand mistakes
tai/
βββ src/
β βββ app/ # Next.js App Router
β β βββ page.tsx # Main application page
β β βββ actions.ts # Server actions
β β βββ api/ # API routes
β β βββ assignment/ # Assignment pages
β β βββ dashboard/ # Analytics dashboard
β βββ components/ # React components
β β βββ ui/ # Reusable UI components
β β βββ assignment-*.tsx # Assignment-related
β β βββ student-*.tsx # Student-related
β βββ lib/ # Core business logic
β β βββ database.ts # In-memory database
β β βββ queries.ts # Data access layer
β β βββ llm.ts # Claude integration
β β βββ ocr/ # OCR engine integration
β β β βββ engines/ # Individual engines
β β β βββ consensus/ # Multi-engine consensus
β β β βββ preprocessing/# PDF processing
β β βββ workflows/ # End-to-end pipelines
β βββ types/ # TypeScript definitions
βββ ocr-services/ # Docker services
β βββ paddleocr-service/
β βββ pix2text-service/
β βββ surya-service/
βββ python/ # Python utilities
βββ scripts/ # Debug/test scripts
TAI supports multiple OCR engines for maximum accuracy:
| Engine | Best For | Speed | Accuracy |
|---|---|---|---|
| Claude | General text, math notation | Fast | High |
| PaddleOCR | Printed text | Very Fast | Medium |
| Pix2Text | Math formulas | Medium | High |
| Surya | Handwriting | Slow | High |
| Mathpix | Complex math | Fast | Very High |
The system uses consensus algorithms to combine results from multiple engines for better accuracy.
1. Student uploads PDF submission
β
2. Multi-engine OCR extraction
β
3. Parse into structured answers (per question)
β
4. Claude AI grades each question
- Compares to solution key
- Applies rubric criteria
- Generates feedback
β
5. TA reviews auto-graded submission
β
6. Release grades to student
β
7. Student views score + feedback
| Endpoint | Method | Purpose |
|---|---|---|
/api/extract-answer-key |
POST | Extract solution key from PDF |
/api/extract-submission |
POST | Extract student answers |
/api/extraction-status/:jobId |
GET | Check extraction job status |
/api/ocr/multi-scan |
POST | Run multi-engine OCR |
/api/test-grading-pipeline |
POST | Test grading system |
/api/sync/assignment |
POST | Sync assignment data |
/api/sync/submission |
POST | Sync submission data |
/api/sync/rubric |
POST | Sync rubric data |
/api/submission-detail |
GET | Get submission details |
ANTHROPIC_API_KEY- Required for Claude AI gradingMATHPIX_APP_ID- Optional for Mathpix OCRMATHPIX_APP_KEY- Optional for Mathpix OCRNEXT_PUBLIC_*- Client-side environment variables
- Max PDF size: 10MB
- Configurable in
next.config.ts
# No tests yet - see REFACTORING_PLAN.md
npm run testnpm run buildnpm run lintCurrent Version (Prototype/MVP):
- In-memory database (data lost on restart)
- No authentication/authorization
- No persistent file storage
- No landing page or onboarding
- Limited error handling
- No test coverage
See REFACTORING_PLAN.md for production roadmap.
- Next.js 16: App Router for modern React patterns, Server Actions for type-safe APIs
- Claude Sonnet 4.5: State-of-the-art reasoning for accurate grading
- Docker: Isolated OCR services for reliability
- TypeScript: Type safety across entire stack
- Radix UI: Accessible, composable components
See issues and planned improvements in REFACTORING_PLAN.md.
[Add license information]
[Add contact information]