SuriRaja commited on
Commit
4a4e5a4
·
1 Parent(s): 591c952

Create metrics_service.py

Browse files
Files changed (1) hide show
  1. services/metrics_service.py +22 -0
services/metrics_service.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # services/metrics_service.py
2
+
3
+ import random
4
+
5
+ # Define dummy anomaly types (same as videos you created)
6
+ ANOMALY_TYPES = [
7
+ "Thermal Anomaly Detected",
8
+ "Panel Broken Detected",
9
+ "Human Intrusion Detected",
10
+ "Fire Detected",
11
+ ]
12
+
13
+ # You can expand metrics here
14
+ def get_live_metrics(anomaly_type):
15
+ """Simulate live metrics based on anomaly type."""
16
+ metrics = {
17
+ "Thermal Anomaly Detected": f"🔥 Hotspot Temperature: {random.randint(70, 120)} °C",
18
+ "Panel Broken Detected": f"⚡ Broken Panels: {random.randint(1, 3)} detected",
19
+ "Human Intrusion Detected": f"🚶 People Count: {random.randint(1, 2)} moving in area",
20
+ "Fire Detected": f"🚒 Fire Alert Level: {random.randint(5, 10)} / 10",
21
+ }
22
+ return f"**{anomaly_type}**\n\n{metrics.get(anomaly_type, 'No anomaly detected')}"