CoolFace
Apppublic

yashrajsinha/postSURE

sourceHugging Facemitupdated 8mo agoView on Hugging Face
0likes
App README

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

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
└── Dockerfile

API Endpoints

EndpointMethodDescription
/api/healthGETHealth check
/api/classifyPOSTClassify 66 landmarks
/api/calibratePOSTStore training sample
/api/calibrate/statusGETGet sample counts
/api/trainPOSTRetrain model
/api/model/statusGETModel info

Development

Backend

bash
pip install -r requirements.txt
python api/app.py
# API at http://localhost:8080
# Swagger at http://localhost:8080/apidocs/

Frontend

bash
cd frontend
npm install
npm run dev
# App at http://localhost:5173

Environment Variables

Frontend (.env.local or Vercel):

VITE_API_URL=http://localhost:8080

Deployment

Backend → HuggingFace Spaces

Automatic via GitHub Actions on push to main (backend files only).

Frontend → Vercel

  1. 1.Link GitHub repo to Vercel
  2. 2.Set root directory: frontend
  3. 3.Set env var: VITE_API_URL=https://yashrajsinha-postsure.hf.space

License

MIT