Spaces:
Sleeping
Sleeping
|
Download claude.md from kingune/framematch: direct link, hf CLI and curl.
- Browser
- Download file 4.64 kB
-
https://huggingface.co/spaces/kingune/framematch/resolve/main/claude.md
- Command line
-
hf download hf://spaces/kingune/framematch/claude.md
-
curl -L -o claude.md https://huggingface.co/spaces/kingune/framematch/resolve/main/claude.md
4.64 kB
FrameMatch - Claude Code Guidelines
Project Overview
FrameMatch is an AI-powered web tool for photographers and cinematographers that analyzes reference images and provides recreation guides with camera settings, lighting analysis, and color grading recommendations.
Live deployments:
- Frontend: https://framematch.pages.dev (Cloudflare Pages)
- Backend API: https://kingune-framematch.hf.space (HuggingFace Spaces)
Tech Stack
- Frontend: React 19 + Vite 7 + TailwindCSS 4
- Backend: Python 3.12 + FastAPI + Pillow + NumPy + ColorThief
- Deployment: Cloudflare Pages (frontend), HuggingFace Spaces with Docker (backend)
Development Commands
Frontend
cd frontend
npm install
npm run dev # Start dev server at localhost:5173
npm run build # Build for production
npm run lint # Run ESLint
Backend
cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000
Docker (HuggingFace Spaces)
# Build combined container (serves both frontend and backend)
docker build -t framematch .
docker run -p 7860:7860 framematch
Project Structure
framematch/
βββ frontend/
β βββ src/
β β βββ App.jsx # Main app with upload flow
β β βββ main.jsx # React entry point
β β βββ components/
β β βββ ImageUploader.jsx # Drag-drop image upload
β β βββ LoadingAnalysis.jsx # Loading spinner
β β βββ AnalysisResults.jsx # Results container
β β βββ CameraPanel.jsx # Camera settings display
β β βββ LightingPanel.jsx # Lighting analysis display
β β βββ ColorPanel.jsx # Color palette display
β β βββ LightingDiagram.jsx # Visual lighting diagram
β βββ package.json
βββ backend/
β βββ app/
β β βββ main.py # FastAPI endpoints
β β βββ services/
β β βββ analyzer.py # ImageAnalyzer class
β βββ requirements.txt
β βββ Dockerfile
βββ Dockerfile # Combined Docker for HF Spaces
βββ render.yaml # Render deployment config
βββ README.md # HuggingFace Spaces metadata
API Endpoints
POST /api/analyze- Upload image, returns analysis JSONGET /api/health- Health check endpoint
Key Analysis Features
Camera Analysis (backend/app/services/analyzer.py:29)
- Focal length estimation: Uses edge sharpness falloff, vignetting, and gradient variance to detect wide vs telephoto lenses
- Aperture/DoF: Based on edge variance in grayscale image
- ISO hint: Based on overall brightness
- Shutter speed: Motion blur detection via Laplacian variance
Lighting Analysis (backend/app/services/analyzer.py:205)
- Key light direction (left/right/frontal) via brightness comparison
- Vertical angle estimation
- Light quality (hard/soft) via contrast measurement
- Lighting patterns: Split, Rembrandt, Butterfly, Loop
Color Analysis (backend/app/services/analyzer.py:312)
- Color palette extraction using ColorThief
- Temperature detection (warm/cool/neutral)
- Shadow and highlight tint analysis
- Saturation and contrast levels
Environment Variables
VITE_API_URL- Backend API URL for frontend (empty for same-origin in Docker)
Deployment Notes
Cloudflare Pages (Frontend)
- Deploy from
frontenddirectory - Build command:
npm run build - Output directory:
dist - Set
VITE_API_URL=https://kingune-framematch.hf.spacein environment
HuggingFace Spaces (Backend)
- Uses root
Dockerfilefor combined deployment - SDK: Docker
- Port: 7860
- Nginx proxies
/apito uvicorn on port 8000
Known Issues & Solutions
- JSON serialization errors with numpy: Wrap numpy boolean comparisons with
bool()before returning in API responses - scipy installation failures on HF Spaces: Avoid scipy dependency; use simple algorithms instead
- Focal length always showing same value: The
_estimate_focal_lengthmethod analyzes edge sharpness falloff, vignetting, and gradient variance
Code Style
- Frontend: React functional components with hooks, amber/orange color theme (avoid purple/violet)
- Backend: Python type hints, descriptive method names
- Keep dependencies minimal for HF Spaces compatibility