Sanjayraju30 commited on
Commit
9c4ef19
·
verified ·
1 Parent(s): 6228c33

Create fault_service.py

Browse files
Files changed (1) hide show
  1. services/fault_service.py +11 -0
services/fault_service.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ultralytics import YOLO
2
+
3
+ fault_model = YOLO("pole_fault_model.pt")
4
+
5
+ def detect_pole_faults(image_path):
6
+ results = fault_model(image_path)
7
+ flagged = []
8
+ for r in results:
9
+ if hasattr(r, 'fault_type') and r.conf > 0.6:
10
+ flagged.append({"fault_type": r.fault_type, "confidence": r.conf})
11
+ return flagged