-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
38 lines (28 loc) · 1.16 KB
/
app.py
File metadata and controls
38 lines (28 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# app.py
import streamlit as st
import pandas as pd
from PIL import Image
import os
from detector import detect_accidents_from_camera
st.set_page_config(page_title="Accident Detection Dashboard", layout="wide")
st.title("🚗 Real-Time Accident Detection Dashboard")
st.sidebar.header("Instructions:")
st.sidebar.text("Click the button below to start accident detection on your webcam feed.")
if st.button("▶️ Run Detection on Video"):
("video_feed1.mp4")
st.success("Detection Completed!")
if st.button("▶️ Start Detection"):
st.text("Starting real-time camera feed...")
detect_accidents_from_camera() # Call the accident detection function for webcam feed
st.success("Detection Completed!")
# Show accident logs and saved frames
if os.path.exists("logs.csv"):
st.subheader("📁 Accident Evidence Log")
df = pd.read_csv("logs.csv")
st.dataframe(df)
for i, row in df.iterrows():
st.markdown(f"### 🕒 {row['timestamp']}")
img_path = row['frame_path']
st.image(img_path, width=600)
else:
st.info("No accidents detected yet. Click the button above to start detection.")