Spaces:
Sleeping
Sleeping
File size: 1,987 Bytes
9b76f08 3b6887b c0e0bd9 9b76f08 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | ---
title: Face Tracker Demo
emoji: 🎥
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: "5.9.1"
app_file: app.py
python_version: "3.10"
pinned: false
license: apache-2.0
short_description: Real-time multi-person face detection, tracking & ID
---
# Face Tracker Demo (web)
Browser demo of the pipeline in `../app`: live webcam → InsightFace detection
→ ArcFace embedding → ByteTrack → FAISS identity match → boxes/IDs drawn in
your browser. Nothing is recorded or stored; state lives only in your tab for
the session and is discarded on reload.
This is **not** the NUC/production app - it's a lightweight, standalone copy
tuned for a shared free CPU (smaller `buffalo_s` model pack, 320px detection,
2 ONNX Runtime threads by default). See `../app/README.md` for the real
RTSP/webcam app this demonstrates.
## Deploying
1. Create a new Space at https://huggingface.co/new-space with SDK "Gradio".
2. Push the contents of this folder (not the whole repo) to the Space's git
remote:
```bash
cd webdemo
git init
git remote add space https://huggingface.co/spaces/<your-username>/<space-name>
git add -A
git commit -m "Face tracker web demo"
git push space main
```
3. The Space builds automatically from `requirements.txt` and launches
`app.py`. First build takes a few minutes (downloads the `buffalo_s` model
pack on first request).
## Local test before deploying
```bash
cd webdemo
pip install -r requirements.txt
python app.py
```
Opens at http://127.0.0.1:7860 - allow webcam access in the browser.
## Tuning via environment variables
Set these as Space secrets/variables, or env vars for local testing:
| Variable | Default | Notes |
|---|---|---|
| `DET_SIZE` | `320` | detector input size |
| `MODEL_NAME` | `buffalo_s` | or `buffalo_l` for more accuracy, slower |
| `ONNX_THREADS` | `2` | match the Space's CPU tier core count |
| `MATCH_THRESHOLD` | `0.38` | cosine similarity for matching a face to an existing ID |
|