yashrajsinha/postSURE
0
PostSURE - Real-time Posture Classification
A microservices-based posture classification system using MediaPipe (browser) and PyTorch (server).
Architecture
┌─────────────────┐ ┌─────────────────┐
│ Frontend │ API │ Backend │
│ (Vercel) │◄───────►│ (HF Spaces) │
│ │ │ │
│ TypeScript │ │ Flask API │
│ MediaPipe JS │ │ PyTorch Model │
│ Vite │ │ Gunicorn │
└─────────────────┘ └─────────────────┘Quick Links
- Frontend: postsure.vercel.app (update after deploy)
- API Docs: postSURE.hf.space/apidocs
Features
- Real-time pose detection in browser (MediaPipe JS - no server round-trip for video)
- REST API for classification, calibration, and training
- Swagger documentation at
/apidocs/ - Calibration mode to train personalized model
Project Structure
posture/
├── api/
│ └── app.py # Flask REST API with Swagger
├── frontend/
│ ├── src/
│ │ ├── main.ts # MediaPipe + UI
│ │ ├── api.ts # API client
│ │ └── style.css # Dark theme
│ ├── index.html
│ └── vercel.json
├── src/
│ └── classifier.py # PyTorch model classes
├── models/
│ └── posture_model.pth
├── requirements.txt
└── DockerfileAPI Endpoints
Development
Backend
pip install -r requirements.txt
python api/app.py
# API at http://localhost:8080
# Swagger at http://localhost:8080/apidocs/Frontend
cd frontend
npm install
npm run dev
# App at http://localhost:5173Environment Variables
Frontend (.env.local or Vercel):
VITE_API_URL=http://localhost:8080Deployment
Backend → HuggingFace Spaces
Automatic via GitHub Actions on push to main (backend files only).
Frontend → Vercel
- Link GitHub repo to Vercel
- Set root directory:
frontend - Set env var:
VITE_API_URL=https://yashrajsinha-postsure.hf.space
License
MIT
