Spaces:
Build error
Build error
Create thermal_service.py
Browse files- services/thermal_service.py +13 -0
services/thermal_service.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from PIL import Image
|
| 2 |
+
import numpy as np
|
| 3 |
+
|
| 4 |
+
class ThermalService:
|
| 5 |
+
def detect_hotspots(self, image, detection_service, confidence_threshold):
|
| 6 |
+
"""Detect overheating in thermal images."""
|
| 7 |
+
# For demo, assume DETR detects 'hotspot' (requires fine-tuning)
|
| 8 |
+
detections = detection_service.detect_objects(image, confidence_threshold)
|
| 9 |
+
# Placeholder: Filter for thermal-specific labels (e.g., 'hotspot')
|
| 10 |
+
thermal_detections = [
|
| 11 |
+
d for d in detections if d["label"] in ["hotspot", "overheating"]
|
| 12 |
+
]
|
| 13 |
+
return thermal_detections
|