#!/bin/bash # Bootstrap the pose-estimation venv + model. Idempotent — safe to run every time. # MediaPipe supports Python <= 3.12, so we pin the interpreter explicitly. set -euo pipefail SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" VENV="$SKILL_DIR/.venv" MODEL="$SKILL_DIR/models/pose_landmarker_full.task" MODEL_URL="https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_full/float16/latest/pose_landmarker_full.task" PY="" for cand in python3.12 python3.11 python3.10; do if command -v "$cand" >/dev/null 2>&1; then PY="$cand"; break; fi done if [ -z "$PY" ]; then echo "ERROR: need python 3.10-3.12 for mediapipe (found none). brew install python@3.12" >&2 exit 1 fi if [ ! -x "$VENV/bin/python" ]; then "$PY" -m venv "$VENV" fi "$VENV/bin/pip" install --quiet --upgrade pip "$VENV/bin/pip" install --quiet "mediapipe>=0.10.9" "opencv-python>=4.8" "numpy" if [ ! -f "$MODEL" ]; then mkdir -p "$SKILL_DIR/models" curl -sL -o "$MODEL" "$MODEL_URL" fi echo "OK: venv at $VENV, model at $MODEL" echo "Run: $VENV/bin/python $SKILL_DIR/scripts/extract_pose.py --help"