SuriRaja commited on
Commit
86ed826
·
1 Parent(s): 55587ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -52,7 +52,7 @@ def monitor_feed():
52
  cv2.putText(frame, f"{timestamp}", (10, 50), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 255, 0), 2)
53
 
54
  # Update logs and anomaly counts
55
- anomaly_detected = len(metrics['anomalies']) if 'anomalies' in metrics else 0
56
  log_entries.append(f"{timestamp} - Frame {frame_count} - Anomalies Detected: {anomaly_detected}")
57
  anomaly_counts.append(anomaly_detected)
58
 
@@ -61,7 +61,11 @@ def monitor_feed():
61
  if len(anomaly_counts) > 100:
62
  anomaly_counts.pop(0)
63
 
64
- return frame[:, :, ::-1], metrics, "\n".join(log_entries[-10:]), generate_chart()
 
 
 
 
65
 
66
  # Chart generator
67
  def generate_chart():
 
52
  cv2.putText(frame, f"{timestamp}", (10, 50), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 255, 0), 2)
53
 
54
  # Update logs and anomaly counts
55
+ anomaly_detected = metrics["anomalies_detected"]
56
  log_entries.append(f"{timestamp} - Frame {frame_count} - Anomalies Detected: {anomaly_detected}")
57
  anomaly_counts.append(anomaly_detected)
58
 
 
61
  if len(anomaly_counts) > 100:
62
  anomaly_counts.pop(0)
63
 
64
+ # THIS IS IMPORTANT FIX 👇
65
+ label_output = {"Anomalies": anomaly_detected}
66
+
67
+ return frame[:, :, ::-1], label_output, "\n".join(log_entries[-10:]), generate_chart()
68
+
69
 
70
  # Chart generator
71
  def generate_chart():