Spaces:
Running
Running
File size: 1,560 Bytes
a84ec2f fa700aa a84ec2f fa700aa a84ec2f fa700aa 2bfebd8 fa700aa 2bfebd8 fa700aa 2bfebd8 fa700aa 2bfebd8 fa700aa 2bfebd8 | 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 | ---
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 |
|