Spaces:
Running
Running
Khunndev
feat: Implement JSON detection endpoint, externalize configuration via environment variables, and enhance health checks.
2bfebd8 |
Download README.md from npisb/pipecountapp: direct link, hf CLI and curl.
- Browser
- Download file 1.56 kB
-
https://huggingface.co/spaces/npisb/pipecountapp/resolve/main/README.md
- Command line
-
hf download hf://spaces/npisb/pipecountapp/README.md
-
curl -L -o README.md https://huggingface.co/spaces/npisb/pipecountapp/resolve/main/README.md
1.56 kB
| title: Pipe Count | |
| emoji: 🔧 | |
| colorFrom: blue | |
| colorTo: green | |
| sdk: docker | |
| app_port: 7860 | |
| pinned: false | |
| # Pipe Counting API | |
| Upload an image of pipes and the API will detect and count them using YOLOv5. | |
| ## Features | |
| - **Object Detection**: Counts pipes in images using YOLOv5 custom model | |
| - **Concurrent Support**: Handles multiple users with queue management | |
| - **JSON API**: Get count and coordinates without image rendering | |
| - **Health Monitoring**: Check API status and queue info | |
| ## API Endpoints | |
| | Endpoint | Method | Description | | |
| |----------|--------|-------------| | |
| | `/` | GET | Web interface | | |
| | `/detectImage` | POST | Upload image, get annotated result | | |
| | `/detect/json` | POST | Upload image, get JSON response | | |
| | `/health` | GET | Health check with config info | | |
| ## Usage | |
| **Get annotated image:** | |
| ```bash | |
| curl -X POST -F "file=@image.jpg" https://your-space.hf.space/detectImage -o result.jpg | |
| ``` | |
| **Get JSON response (faster):** | |
| ```bash | |
| curl -X POST -F "file=@image.jpg" https://your-space.hf.space/detect/json | |
| ``` | |
| **Response:** | |
| ```json | |
| { | |
| "count": 42, | |
| "detections": [{"id": 1, "x": 150, "y": 200, "confidence": 0.95}, ...], | |
| "processing_time_ms": 2340 | |
| } | |
| ``` | |
| ## Configuration (Environment Variables) | |
| | Variable | Default | Description | | |
| |----------|---------|-------------| | |
| | `MAX_CONCURRENT` | 2 | Max concurrent inferences | | |
| | `MAX_QUEUE_SIZE` | 10 | Max queued requests | | |
| | `REQUEST_TIMEOUT` | 60 | Timeout in seconds | | |
| | `CONFIDENCE_THRESHOLD` | 0.6 | Detection confidence | | |
| | `JPEG_QUALITY` | 85 | Output image quality | | |