RuchirKadam1729/autograder-miniproj
0
AI Exam Grader
Automated marking of handwritten student answer PDFs using Florence-2 (vision OCR) + Groq LLaMA 3.3 (rubric grading).
exam-grader/
├── app.py ← Gradio frontend (HF Spaces entry point)
├── src/
│ ├── config.py ← Centralised config & env vars
│ ├── llm_client.py ← Groq API client
│ ├── vision.py ← Florence-2 wrapper
│ ├── synoptic.py ← Marking-scheme parser
│ ├── extraction.py ← PDF → answer segments
│ ├── grading.py ← LLM-based marks awarding
│ └── pipeline.py ← Orchestrator
├── tests/
├── jenkins/
├── Dockerfile
├── docker-compose.yml ← SonarQube + Jenkins stack
├── sonar-project.properties
├── Jenkinsfile
└── requirements.txt1 — Get a Free Groq API Key
- Go to console.groq.com and sign up (free)
- Create an API key → copy it (
gsk_...) - Set it:
export GROQ_API_KEY="gsk_..."
2 — Run Locally
pip install -r requirements.txt
export GROQ_API_KEY="gsk_your_key_here"
python app.py
# → open http://localhost:78603 — Deploy to Hugging Face Spaces
pip install huggingface_hub
huggingface-cli loginpython - <<'EOF'
from huggingface_hub import HfApi
api = HfApi()
# Create space (once)
api.create_repo(
repo_id="YOUR-USERNAME/exam-grader",
repo_type="space",
space_sdk="docker",
exist_ok=True,
)
# Push code
api.upload_folder(
folder_path=".",
repo_id="YOUR-USERNAME/exam-grader",
repo_type="space",
ignore_patterns=["*.pyc", "__pycache__", ".venv", ".git", "tests"],
)
print("Deployed!")
EOFThen in the HF Space settings → Secrets, add:
4 — SonarQube + Jenkins (DevOps Lab)
Start the stack
docker compose up -d
# SonarQube → http://localhost:9000 (admin/admin)
# Jenkins → http://localhost:8080Run a scan (no Jenkins needed)
# Generate coverage
pytest tests/ --cov=src --cov-report=xml:coverage.xml
# Set your SonarQube token
export SONAR_TOKEN="sqp_your_token_here"
# Scan
docker compose --profile scan run --rm sonar-scannerOpen http://localhost:9000/dashboard?id=exam-grader
Jenkins pipeline
Add these credentials in Jenkins → Manage → Credentials:
Create a Pipeline job → point to this repo → Build Now.
5 — Groq Model Options
6 — Marking Scheme Format
Your synoptic .xlsx / .csv must have:
