PROBLEM: Zero-shot models were calling external Gradio Spaces that were unreliable/offline, causing no detections.
SOLUTION: Replaced external API calls with local HuggingFace transformers inference.
New Implementations:
1. CLIP Anomaly Detection (replaces AdaCLIP):
- Uses openai/clip-vit-base-patch32 model locally
- Compares images against normal vs defect text descriptions
- Returns anomaly probability score
- Fast and reliable (no external dependencies)
- Red bounding boxes for detected anomalies
2. OWL-ViT Object Detection (fixed):
- Uses google/owlv2-base-patch16-ensemble locally
- Text-guided zero-shot object detection
- Default queries: defect, anomaly, crack, scratch, damage
- Returns actual bounding boxes from model
- Blue bounding boxes for detected objects
Technical Changes:
- Added dependencies: transformers, torch, torchvision, pillow
- Model caching on first load (function attributes)
- Proper error logging with tracebacks
- Lower defaul…