--- title: Wafer Defect Model API emoji: 🌀 colorFrom: blue colorTo: indigo sdk: docker app_port: 7860 pinned: false --- # Wafer Defect Model API (remote inference backend) Hosts `radai-agent/radai-wm811k-defect-detection` (RadAI WM-811K ResNet34) on Hugging Face's infrastructure and exposes it as a small JSON API, so your local wafer defect tool doesn't need torch/torchvision installed. ## Endpoints - `GET /` — health check - `POST /predict_map` — body: `{"wafer_map": [[...], [...], ...]}` (2D array, any size, raw grayscale or bin values). Returns: ```json { "predictions": [{"label": "Edge-Ring", "desc": "...", "prob": 0.87}, ...], "preview_raw": [[...64x64, 0-1 normalized...]] } ``` ## Deploying 1. On huggingface.co, create a new Space -> SDK: **Docker**, hardware: free CPU basic. 2. Push these files (`app.py`, `requirements.txt`, `Dockerfile`, this `README.md`) to the Space's git repo. 3. Wait for the build to finish, then note the Space URL, e.g. `https://YOUR-USERNAME-wafer-defect-model.hf.space`. 4. Free-tier Spaces sleep after inactivity and take ~20-30s to wake on the first request afterward — expected, not a bug.