forked from SIH-Insight/TeamInsight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
website.py
179 lines (139 loc) Β· 6.58 KB
/
website.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
import streamlit as st
import time
from PIL import Image
import io
import math
from src.crime import crime
from src.crowd import crowd_management as cm
from src.garbage import garbage
from src.work import work
# Define a custom CSS class for bold and italic text
st.set_page_config(page_title='Smart CCTV', page_icon=':camera:')
header_style = """
<style>
.bold-header {
font-weight: bold;
font-size: 2.75em;
}
.italic-text {
font-style: italic;
font-size: 1.5em;
}
.sidebar-radio label {
font-size: 1.5em !important;
}
italic-new{
font-style: italic;
font-size: 3.0em;
}
.bold-2 {
font-weight: bold;
font-size: 2.0em;
}
.bold-1 {
font-weight: bold;
font-size: 1.0em;
}
</style>
"""
# Add the custom CSS to the page
st.markdown(header_style, unsafe_allow_html=True)
# Display the header with the custom style using Markdown
st.markdown("<p class='bold-header'>Smart CCTV Integration Using AI/ML</p>", unsafe_allow_html=True)
# Add a newline
st.text(" ")
# List of actions in the sidebar
st.sidebar.markdown("<p class='bold-2'>What do you need?</p>",unsafe_allow_html=True)
selected_action = st.sidebar.radio("",["Work Monitoring", "Crime Detection", "Crowd Management","Garbage Detection"], key="action")
# Apply custom CSS for the sidebar radio options
sidebar_style = """
<style>
div[data-baseweb="radio"] label {
font-size: 20px !important;
}
</style>
"""
st.markdown(sidebar_style, unsafe_allow_html=True)
# Handle actions based on the selected option
if selected_action == "Work Monitoring":
st.sidebar.markdown("<p class='italic-text'>Monitor work environments for productivity and safety.</p>", unsafe_allow_html=True)
# Display video upload page
st.markdown("## Monitor work 24/7:")
# Add a file uploader widget
uploaded_file = st.file_uploader("Upload a video file", type=["mp4", "avi", "mov"])
if uploaded_file is not None:
with st.spinner('Loading....'):
video_bytes = uploaded_file.read()
df = work.work_management(video_bytes)
df['human_count'] = df['human_count'].apply(lambda x: math.ceil(x))
df['timestamp'] = df['timestamp'].apply(lambda x: x.round(5))
st.title('Work Monitoring')
st.bar_chart(df.set_index('timestamp'))
time.sleep(5)
st.success('Done!')
elif selected_action == "Crime Detection":
st.sidebar.markdown("<p class='italic-text'>Proactively detect criminal activity and enhance public safety.</p>", unsafe_allow_html=True)
st.markdown("## Detect crimes:")
# Add a file uploader widget
uploaded_file = st.file_uploader("Upload a video file", type=["mp4", "avi", "mov"])
if uploaded_file is not None:
with st.spinner('Loading....'):
video_bytes = uploaded_file.read()
predicted_video = crime.predict_frames(video_bytes, 16)
a,b=crime.predict_video(video_bytes, 16)
st.write("Predicted: ",a)
st.write("Confidence: ",b)
time.sleep(5)
st.success('Done!')
elif selected_action == "Crowd Management":
st.sidebar.markdown("<p class='italic-text'>Efficiently manage crowds at public events and crowded areas.</p>", unsafe_allow_html=True)
st.markdown("## Manage crowd:")
uploaded_file = st.file_uploader("Upload a video file", type=["mp4", "avi", "mov"])
if uploaded_file is not None:
with st.spinner('Loading....'):
video_bytes = uploaded_file.read()
df=cm.crowd_management(video_bytes)
df['human_count'] = df['human_count'].apply(lambda x: math.ceil(x))
# Create a Streamlit app
st.title('Human Count over Time')
st.line_chart(df.set_index('timestamp'))
time.sleep(5)
st.success('Done!')
elif selected_action == "Garbage Detection":
st.sidebar.markdown("<p class='italic-text'>Detect and manage garbage or litter in public areas.</p>", unsafe_allow_html=True)
st.markdown("## Detect Garbage:")
# Add a file uploader widget
uploaded_file = st.file_uploader("Upload a video file for garbage detection", type=["jpeg", "png", "jpg"])
if uploaded_file is not None:
image = Image.open(uploaded_file)
st.image(image, caption='Uploaded Image', use_column_width=True)
with st.spinner('Loading....'):
image = Image.open(io.BytesIO(uploaded_file.read()))
prediction=garbage.classify_garbage(image)
st.write(f"Prediction : {prediction}")
time.sleep(5)
st.success('Done!')
st.markdown("<h3 style='text-align: center;'>Empowering Smarter Surveillance</h3>", unsafe_allow_html=True)
st.text(" ")
st.text(" ")
st.text(" ")
# Real-world insights section with a fancy underline
st.markdown("### π Explore Real-World Insights π :")
st.markdown("<p class='italic-text'>Our platform seamlessly combines the power of Artificial Intelligence and Machine Learning to transform your surveillance footage into real-time intelligence. π</p>", unsafe_allow_html=True)
st.text(" ")
# Key features with an emoji
st.markdown("### π Key Features π :")
st.markdown("<p class='italic-text'>Monitor work environments with unparalleled efficiency, proactively detect criminal activity, and manage crowds effortlessly. AI is here to redefine security and productivity. π</p>", unsafe_allow_html=True)
st.text(" ")
# Under the hood section with an emoji
st.markdown("### π΅οΈββοΈ Under the Hood π΅οΈββοΈ :")
st.markdown("<p class='italic-text'>Powered by cutting-edge technologies, we're at the forefront of the AI and ML revolution. From object recognition to anomaly detection, we've got it all. π‘</p>", unsafe_allow_html=True)
st.text(" ")
# User-friendly section with an emoji
st.markdown("### π©βπ» User-Friendly π¨βπ» :")
st.markdown("<p class='italic-text'>No tech wizardry required! With a few clicks, you can transform your surveillance data into actionable insights. π€</p>", unsafe_allow_html=True)
st.text(" ")
# Footer with another call to action
st.subheader("Ready to experience the future of surveillance? Dive in and explore!! π.Get Started Now! π")
# Add a newline in the sidebar
st.sidebar.text(" ")