Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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']}")
|