On-device pose analysis with AI-powered suggestions. Upload a photo, detect body landmarks locally with MediaPipe BlazePose, compare against a reference dataset, and (optionally) get improvement tips from OpenAI.
- On-device detection: MediaPipe Pose Landmarker runs in the browser via CDN (no server needed for detection)
- Keypoint overlay: Visualize 33 keypoints and skeletal connections on your photo
- Similarity search: Finds top reference poses from a local dataset using a weighted similarity metric
- AI suggestions (optional): Sends your photo + two references to OpenAI to generate improvement tips with structured JSON output
- Ionic + Capacitor: Ship to web, iOS, and Android from one codebase
- Material UI: Polished, responsive UI
Prerequisites:
- Node.js 18+ and npm
- Install dependencies (first time only)
npm install- Build and preview (recommended for local run)
npm run build
npm run previewOpen the URL printed by Vite Preview (for example http://localhost:4173/Pose-AI/). This is the only flow you need for local serving.
Optional (live dev server):
npm run devThen open the dev URL (e.g., http://localhost:5173/).
- Upload & detect
- In
UploadPosePage, a user selects an image. The app converts it to Base64 and runs MediaPipe BlazePose in the browser via a dynamic CDN import (seesrc/service/blazePose.ts). - 33 keypoints are returned and stored in Redux (
dataslice).
- Similarity search
- The app loads
/data/keypoints.json(underpublic/) that contains 33-keypoint annotations for reference images in/data/images. - It computes pose similarity with a weighted, body-part-aware metric (see
src/utils/poseComparison.ts) and picks the top-2 matching reference filenames.
- Results & visualization
ResultsPagerenders your photo with a keypoint overlay (KeypointVisualization→drawPoseOnCanvas), displays quick metrics, and shows two recommended references.
- AI suggestions
- If
VITE_OPENAI_API_KEYis set and two references exist,src/service/poseSuggestions.tscalls OpenAI (gpt-4o-2024-08-06) with three images (original + two references) and a structured JSON schema. The response provides improvement bullets and comparisons, rendered on the results page. - If the call fails or is disabled, the page displays helpful built-in tips instead.
- (Experimental) Pose transfer
src/service/imageEdit.tscontains a utility to callgpt-image-1to make image A mimic the pose in image B. This is not wired into the current UI.
Privacy:
- Pose detection and similarity are fully in-browser. If you enable OpenAI, your Base64 images are sent to OpenAI for analysis.
This repo includes tools to create and inspect your own reference dataset.
-
public/data/scripts/keypoint_extractor.html- Drag-and-drop images to produce a compatible
keypoints.jsonusing the same MediaPipe model as the app. - Place resulting
keypoints.jsonintopublic/data/and the corresponding images intopublic/data/images/.
- Drag-and-drop images to produce a compatible
-
public/data/scripts/keypoint_visualizer.html- Upload an image and a
keypoints.jsonto visually verify keypoints and skeleton layout.
- Upload an image and a
Included sample data:
public/data/images/contains sample images.public/data/keypoints.jsoncontains the matching keypoints for those images.
src/
pages/
LandingPage.tsx # Marketing/entry page
UploadPosePage.tsx # Upload, style/focus selection, run detection
ResultsPage.tsx # Visualization, metrics, recommendations, AI tips
components/
CustomPage.tsx # Theme + IonContent wrapper
Alert.tsx # Snackbar alert system
KeypointVisualization.tsx # Canvas draw overlay
service/
blazePose.ts # MediaPipe loader and keypoint estimation
poseSuggestions.ts # OpenAI GPT-4o vision suggestions (JSON schema)
imageEdit.ts # Experimental gpt-image-1 pose transfer
store/
slices/data.ts # Pose data, selections, suggestions
slices/ui.ts # Alerts
store.ts # Redux + redux-persist setup
utils/
poseComparison.ts # Body-part-weighted similarity
draw.ts, skeleton.ts # Canvas drawing helpers
Public assets:
public/data/images/*– reference imagespublic/data/keypoints.json– reference keypointspublic/data/scripts/*.html– dataset tooling
npm run dev # Start Vite dev server
npm run build # Type-check + build to dist
npm run preview # Preview production build
npm run lint # Run eslint
npm run sync # Build and capacitor sync (for native platforms)Capacitor config lives in capacitor.config.ts (appId: com.poseai.app, webDir: dist).
- Build web assets
npm run build- Add platforms (first time)
npx cap add ios
npx cap add android- Copy/sync
npx cap copy
npx cap sync- Open IDE and run
npx cap open ios # Xcode (macOS only)
npx cap open android # Android StudioNotes:
- iOS builds require Xcode on macOS. Android builds require Android Studio + SDKs.
- Because OpenAI calls are made from the client when enabled, consider moving them to a backend for production apps.
Create .env in project root for local development:
VITE_OPENAI_API_KEY=sk-...your_key...Security considerations:
VITE_*env vars are embedded into client bundles. Do not ship real production secrets in the client. Prefer server-side calls.
Model/CDN considerations:
- MediaPipe is loaded via CDN (
@mediapipe/tasks-vision) at runtime. A network connection is required for first load.
-
MediaPipe fails to load
- Ensure network access to
cdn.jsdelivr.net. - Try a hard refresh; some ad-blockers/extensions can block module scripts.
- Ensure network access to
-
Failed to load keypoints dataset- Confirm
public/data/keypoints.jsonexists and is valid JSON. - Ensure images referenced by
filenameexist inpublic/data/images/.
- Confirm
-
OpenAI errors (invalid key, insufficient quota, rate limit)
- Verify
VITE_OPENAI_API_KEYand account billing/limits. - The app will fall back to built-in tips if AI suggestions fail.
- Verify
-
Performance with large datasets
- Very large
keypoints.jsoncan slow startup. Start smaller, or lazy-load subsets.
- Very large
- React 18 + Vite 6
- Ionic React 7 + Capacitor 4
- Material UI 5
- Redux Toolkit + redux-persist
- MediaPipe Tasks Vision (Pose Landmarker)
- OpenAI (gpt-4o for analysis; gpt-image-1 for experimental pose transfer)
MIT © 2025 Michael, Keyu, Yuheng, Yifan — see LICENSE for details.
Images under assets/images/ are used for demo only and should not be redistributed unless otherwise noted.