--- title: Industrial Defect Detection emoji: 🔍 colorFrom: blue colorTo: gray sdk: gradio sdk_version: 6.0.0 app_file: app.py pinned: false license: other short_description: Industrial Defect Detection API with FastAPI and Gradio UI --- # Industrial Defect Detection API A unified service providing both **FastAPI endpoints** (for production) and **Gradio UI** (for testing/demo). ## Features - **FastAPI Endpoints**: RESTful API compatible with MonitaQC's YOLO inference format - **Gradio UI**: Web interface for visual testing and demonstration - **Multiple Models**: Support for 8 different defect detection models - **CPU-based**: Runs on ONNX Runtime (no GPU required) - **Cloud-ready**: Deployed on HuggingFace Spaces ## Available Models Each model has its own dedicated endpoint: | Model | Model Key | API Endpoint | |-------|-----------|--------------| | Data Matrix | `data-matrix` | `/v1/object-detection/data-matrix/detect` | | Dental Implant | `dental-implant` | `/v1/object-detection/dental-implant/detect` | | Ball Pen | `ball-pen` | `/v1/object-detection/ball-pen/detect` | | Knit Up | `knit-up` | `/v1/object-detection/knit-up/detect` | | Knit Back | `knit-back` | `/v1/object-detection/knit-back/detect` | | Jean Up | `jean-up` | `/v1/object-detection/jean-up/detect` | | Jean Back | `jean-back` | `/v1/object-detection/jean-back/detect` | | Tire Cord | `tire-cord` | `/v1/object-detection/tire-cord/detect` | **Full URLs:** - Data Matrix: `https://smartfalcon-ai-industrial-defect-detection.hf.space/v1/object-detection/data-matrix/detect` - Dental Implant: `https://smartfalcon-ai-industrial-defect-detection.hf.space/v1/object-detection/dental-implant/detect` - Ball Pen: `https://smartfalcon-ai-industrial-defect-detection.hf.space/v1/object-detection/ball-pen/detect` - Knit Up: `https://smartfalcon-ai-industrial-defect-detection.hf.space/v1/object-detection/knit-up/detect` - Knit Back: `https://smartfalcon-ai-industrial-defect-detection.hf.space/v1/object-detection/knit-back/detect` - Jean Up: `https://smartfalcon-ai-industrial-defect-detection.hf.space/v1/object-detection/jean-up/detect` - Jean Back: `https://smartfalcon-ai-industrial-defect-detection.hf.space/v1/object-detection/jean-back/detect` - Tire Cord: `https://smartfalcon-ai-industrial-defect-detection.hf.space/v1/object-detection/tire-cord/detect` ## API Usage ### FastAPI Endpoints **Detect with Default Model:** ```bash POST /v1/object-detection/detect Content-Type: multipart/form-data Parameters: - image: file (required) - model: string (optional, default: data-matrix) - confidence: float (optional, default: 0.25) ``` **Detect with Specific Model:** ```bash POST /v1/object-detection/{model_name}/detect Content-Type: multipart/form-data Parameters: - image: file (required) - confidence: float (optional, default: 0.25) ``` **Example:** ```bash curl -X POST "https://smartfalcon-ai-industrial-defect-detection.hf.space/v1/object-detection/data-matrix/detect" \ -F "image=@test.jpg" \ -F "confidence=0.25" ``` **Response Format:** ```json [ { "bbox": [x1, y1, x2, y2], "confidence": 0.85, "class_id": 0, "x1": 100.0, "y1": 150.0, "x2": 200.0, "y2": 250.0 } ] ``` ## Integration with MonitaQC 1. Open MonitaQC status page: http://localhost:5050/status 2. Go to "Infrastructure Configuration" 3. Update YOLO URL to: `https://smartfalcon-ai-industrial-defect-detection.hf.space/v1/object-detection/data-matrix/detect` 4. Click "Set URL" ## Documentation - **API Docs**: [/docs](https://smartfalcon-ai-industrial-defect-detection.hf.space/docs) - **Health Check**: [/health](https://smartfalcon-ai-industrial-defect-detection.hf.space/health) - **List Models**: [/models](https://smartfalcon-ai-industrial-defect-detection.hf.space/models)