-
Notifications
You must be signed in to change notification settings - Fork 5
/
app.py
57 lines (49 loc) · 1.46 KB
/
app.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
from pathlib import Path
import streamlit as st
import helper
import settings
st.set_page_config(
page_title="Waste Detection",
)
st.sidebar.title("Detect Console")
model_path = Path(settings.DETECTION_MODEL)
st.title("Intelligent waste segregation system")
st.write("Start detecting objects in the webcam stream by clicking the button below. To stop the detection, click stop button in the top right corner of the webcam stream.")
st.markdown(
"""
<style>
.stRecyclable {
background-color: rgba(233,192,78,255);
padding: 1rem 0.75rem;
margin-bottom: 1rem;
border-radius: 0.5rem;
margin-top: 0 !important;
font-size:18px !important;
}
.stNonRecyclable {
background-color: rgba(94,128,173,255);
padding: 1rem 0.75rem;
margin-bottom: 1rem;
border-radius: 0.5rem;
margin-top: 0 !important;
font-size:18px !important;
}
.stHazardous {
background-color: rgba(194,84,85,255);
padding: 1rem 0.75rem;
margin-bottom: 1rem;
border-radius: 0.5rem;
margin-top: 0 !important;
font-size:18px !important;
}
</style>
""",
unsafe_allow_html=True
)
try:
model = helper.load_model(model_path)
except Exception as ex:
st.error(f"Unable to load model. Check the specified path: {model_path}")
st.error(ex)
helper.play_webcam(model)
st.sidebar.markdown("This is a demo of the waste detection model.", unsafe_allow_html=True)