Spaces:
Sleeping
Sleeping
| title: NeuroFocus Backend | |
| emoji: 🧠 | |
| colorFrom: indigo | |
| colorTo: purple | |
| sdk: docker | |
| app_port: 7860 | |
| pinned: false | |
| # NeuroFocus Backend | |
| FastAPI object detection service powering the NeuroFocus visual attention simulator. | |
| Loads `facebook/detr-resnet-50` and exposes detection results over a REST API. | |
| > NeuroFocus is a neuro-inspired **simulation**. It does not measure or diagnose | |
| > attention, ADHD, fatigue, or any neurological condition. | |
| ## Endpoints | |
| | Method | Path | Description | | |
| | ------ | ---------------- | --------------------------------------------- | | |
| | GET | `/` | Service info | | |
| | GET | `/health` | Status + device | | |
| | POST | `/detect` | Image → `{image_size, objects}` | | |
| | POST | `/analyze-focus` | Image → `{image_size, objects, scores, note}` | | |
| `/detect` and `/analyze-focus` accept `multipart/form-data` with a `file` field. | |
| ## Run locally | |
| ```bash | |
| pip install -r requirements.txt | |
| uvicorn app:app --port 7860 --reload | |
| ``` | |
| Then open http://localhost:7860/docs to try uploads interactively. | |
| ## Deploy to Hugging Face | |
| Create a **Docker** Space (CPU Basic is free), then push the contents of this | |
| `backend/` directory. The first boot downloads the DETR model (~160 MB); CPU | |
| inference takes a few seconds per image, which is fine for a demo. | |