Sanjayraju30 commited on
Commit
0291f7c
·
verified ·
1 Parent(s): 9b01ef5

Rename thermal_service.py to services/thermal_service.py

Browse files
Files changed (2) hide show
  1. services/thermal_service.py +9 -0
  2. thermal_service.py +0 -12
services/thermal_service.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import cv2
3
+
4
+ # Simulate thermal anomaly by analyzing red channel brightness
5
+ def detect_thermal_anomalies(image_path):
6
+ image = cv2.imread(image_path)
7
+ red_channel = image[:, :, 2]
8
+ avg_temp = red_channel.mean()
9
+ return avg_temp > 180 # Simulate overheat detection (like >75°C)
thermal_service.py DELETED
@@ -1,12 +0,0 @@
1
- from ultralytics import YOLO
2
-
3
- # Load thermal model
4
- thermal_model = YOLO("thermal_model.pt") # You must upload your model here
5
-
6
- def detect_thermal_anomalies(image_path):
7
- results = thermal_model(image_path)
8
- flagged = []
9
- for r in results:
10
- if hasattr(r, 'temperature') and r.temperature > 75:
11
- flagged.append(r)
12
- return flagged