Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
6.6.0
metadata
title: Bus Inspection Classifier
emoji: π
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 6.2.0
app_file: app.py
pinned: false
license: mit
π Bus Inspection Classifier - SigLIP v2 ONNX
An automated bus component classification system using the SigLIP v2 vision model, optimized with ONNX Runtime for fast inference.
π― Model Details
- Model: SigLIP v2 (Sigmoid Loss for Language-Image Pre-training)
- Format: ONNX (372.6 MB)
- Input: RGB images (224x224)
- Classes: 18 bus component categories
- Inference Time: ~50-100ms per image (CPU)
π Supported Classes
The model can classify the following bus components:
- AC Mat
- Alco brake camera
- Alco-brake device
- Back windshield
- Bus back side
- Bus front side
- Bus side
- Cabin
- Driver grooming
- First aid kit
- Floormats & POS
- Front windshield
- Hat rack
- ITMS Device
- Jack & Spare tyre
- Luggage compartment
- RFID Card
- Seats
π API Usage
Using the Gradio Client (Recommended)
from gradio_client import Client
# Connect to the Space
client = Client("YOUR-USERNAME/bus-inspection")
# Make a prediction
result = client.predict("path/to/bus_image.jpg")
print(result)
# Output: {
# "class_name": "Bus front side",
# "confidence": "98.45%",
# "inference_time_ms": "87.32"
# }
Using Python Requests
import requests
import json
from PIL import Image
import io
# Your Space URL
API_URL = "https://YOUR-USERNAME-bus-inspection.hf.space/api/predict"
# Load image
with open("bus_image.jpg", "rb") as f:
files = {"data": f}
response = requests.post(API_URL, files=files)
result = response.json()
print(f"Class: {result['class_name']}")
print(f"Confidence: {result['confidence']}")
print(f"Inference Time: {result['inference_time_ms']} ms")
Using cURL
curl -X POST https://YOUR-USERNAME-bus-inspection.hf.space/api/predict \
-F "data=@bus_image.jpg"
π Response Format
The API returns a JSON object with the following fields:
{
"class_name": "Bus front side",
"confidence": "98.45%",
"inference_time_ms": "87.32"
}
- class_name: The predicted bus component category
- confidence: Model confidence score as a percentage
- inference_time_ms: Total inference time in milliseconds
π Example Use Cases
- Quality Control: Automated inspection of bus components during manufacturing
- Maintenance Checks: Verify proper installation of safety equipment
- Documentation: Automatically categorize bus inspection photos
- Training: Help inspectors identify components correctly
π οΈ Technical Implementation
- Framework: Gradio for UI and API
- Runtime: ONNX Runtime (CPU optimized)
- Preprocessing: SigLIP normalization (mean=0.5, std=0.5)
- Deployment: Hugging Face Spaces with Git LFS
π License
MIT License - Free for commercial and personal use
π Acknowledgments
Built with SigLIP (Sigmoid Loss for Language-Image Pre-training) from Google Research.