--- title: Anything Detector emoji: 🔍 colorFrom: blue colorTo: purple sdk: gradio sdk_version: "5.49.1" python_version: "3.10" app_file: app.py pinned: false startup_duration_timeout: 1h --- # 🔍 Anything Detector Custom object detection and counting without YOLO. ## Workflow 1. Define classes in `training/classes.txt`. 2. Upload training images. 3. Select an image. 4. Draw bounding boxes directly on the image with the mouse. 5. Choose a class for each box. 6. Save annotations. 7. Train RT-DETR. 8. Upload new images and detect/count objects. The annotation tool is implemented directly with HTML5 Canvas inside Gradio. It does not use the `gradio_image_annotation` package, avoiding the Node.js frontend dependency that can cause Space startup problems. ## Example classes ```text cornetto magnum correto cone cup ``` Or anything else: ```text car truck person dog cat ``` ## Important For production, attach persistent storage to the Space so the dataset and trained model survive rebuilds. ## Startup fix The annotation JavaScript is registered at the Gradio Blocks level rather than using the unsupported `js_on_load` argument on `gr.HTML`. ## GPU This Space is configured for Hugging Face ZeroGPU. GPU-dependent training and inference functions use `@spaces.GPU`; training runs synchronously inside the GPU allocation so a background thread cannot outlive the allocation.