SuriRaja commited on
Commit
09113a9
Β·
verified Β·
1 Parent(s): 9cf9325

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py CHANGED
@@ -213,6 +213,27 @@ if process_btn:
213
  df = pd.DataFrame(rows)
214
  st.dataframe(df)
215
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  st.subheader("πŸ“œ Alert History")
217
  for a in load_alerts()[-10:][::-1]:
218
  st.write(f"{a['time']} [{a['frame']}] β†’ {a['alert']}")
 
213
  df = pd.DataFrame(rows)
214
  st.dataframe(df)
215
 
216
+ # --- Dashboard Cards ---
217
+ st.markdown("### πŸ“Š Compliance Dashboard")
218
+ col1, col2, col3 = st.columns(3)
219
+ col4, col5, col6 = st.columns(3)
220
+
221
+ unapproved_count = int((df["anomalies"].str.contains("UNAPPROVED_QR", na=False)).sum())
222
+ on_phone_count = int((df["anomalies"].str.contains("ON_PHONE", na=False)).sum())
223
+ tampering_count = int((df["anomalies"].str.contains("TAMPERING", na=False)).sum())
224
+ roi_count = int((df["anomalies"].str.contains("OUTSIDE_ROI", na=False)).sum())
225
+ absence_count = int((df["anomalies"].str.contains("ABSENCE", na=False)).sum())
226
+ undecoded_count = int((df["anomalies"].str.contains("UNDECODED_QR", na=False)).sum())
227
+
228
+ col1.metric("❌ Unauthorized QRs", unapproved_count)
229
+ col2.metric("πŸ“± On Phone", on_phone_count)
230
+ col3.metric("⚠️ Tampered", tampering_count)
231
+
232
+ col4.metric("🚫 Outside ROI", roi_count)
233
+ col5.metric("⏳ QR Missing", absence_count)
234
+ col6.metric("πŸ” Undecoded", undecoded_count)
235
+
236
+ # --- Alert History ---
237
  st.subheader("πŸ“œ Alert History")
238
  for a in load_alerts()[-10:][::-1]:
239
  st.write(f"{a['time']} [{a['frame']}] β†’ {a['alert']}")