pipecountapp / README.md
Khunndev
feat: Implement JSON detection endpoint, externalize configuration via environment variables, and enhance health checks.
2bfebd8
|
Raw History Blame Contribute Delete
1.56 kB
metadata
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:

curl -X POST -F "file=@image.jpg" https://your-space.hf.space/detectImage -o result.jpg

Get JSON response (faster):

curl -X POST -F "file=@image.jpg" https://your-space.hf.space/detect/json

Response:

{
  "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