amariayudha commited on
Commit
bb9fe5f
·
verified ·
1 Parent(s): c9c73fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +115 -115
app.py CHANGED
@@ -1,116 +1,116 @@
1
- # app.py
2
-
3
- import streamlit as st
4
- import eda
5
- import prediction
6
-
7
- # Set the page configuration for the Streamlit app
8
- st.set_page_config(
9
- page_title="Waste Classification",
10
- page_icon="♻️",
11
- layout="wide",
12
- initial_sidebar_state="expanded"
13
- )
14
-
15
- def main():
16
- # Create a sidebar for navigation
17
- st.sidebar.title("♻️ Navigation")
18
- page = st.sidebar.radio("Go to", ["🏠 Home", "📊 EDA", "🔍 Prediction"])
19
-
20
- if page == "🏠 Home":
21
- # Add sidebar content for the Home page
22
- st.sidebar.markdown("---")
23
- st.sidebar.subheader("📊 About the Model")
24
- accuracy = 0.82
25
- st.sidebar.write("🎯 Model Accuracy:")
26
- st.sidebar.progress(accuracy)
27
- st.sidebar.write(f"{accuracy:.2%}")
28
- st.sidebar.write("**🤔 What is Accuracy?**")
29
- st.sidebar.write("Accuracy measures how well our model correctly classifies waste items.")
30
- st.sidebar.write("**💡 What does this mean?**")
31
- st.sidebar.write(f"Our model correctly classifies {accuracy:.2%} of waste items, helping improve recycling efficiency.")
32
-
33
- st.sidebar.markdown("---")
34
- st.sidebar.subheader("♻️ Fun Facts")
35
- # Added more fun facts
36
- fun_facts = [
37
- "Proper waste classification can increase recycling rates by up to 50%!",
38
- "Recycling one aluminum can saves enough energy to run a TV for three hours.",
39
- "It takes 450 years for a plastic bottle to decompose in a landfill.",
40
- "Glass can be recycled endlessly without losing quality or purity.",
41
- "Recycling paper saves 17 trees and 7,000 gallons of water per ton of paper."
42
- ]
43
- st.sidebar.info(fun_facts[st.session_state.get('fun_fact_index', 0)])
44
-
45
- # Button to cycle through fun facts
46
- if st.sidebar.button("Next Fun Fact"):
47
- st.session_state['fun_fact_index'] = (st.session_state.get('fun_fact_index', 0) + 1) % len(fun_facts)
48
- st.experimental_rerun()
49
-
50
- # Main content for the Home page
51
- st.title("♻️ Welcome to Waste Classification Tool")
52
- st.write("""
53
- This application provides functionalities for Exploratory Data Analysis and
54
- Prediction of waste types. Use the navigation pane on the left to
55
- select the module you wish to utilize.
56
- """)
57
-
58
- # Display an image in the center column
59
- col1, col2, col3 = st.columns([1,2,1])
60
- with col2:
61
- st.image("https://assets-a1.kompasiana.com/items/album/2021/03/14/dr-stone-fandomcom-1536x864-604dff978ede483a3b589c96.png?t=o&v=780",
62
- caption="Notes: Recycling is crucial for our environment", use_column_width=True)
63
-
64
- st.markdown("---")
65
-
66
- # Information about the dataset
67
- st.write("#### 📊 Dataset")
68
- st.info("""
69
- The dataset used is the RealWaste dataset, containing images of waste items across 9 major material types,
70
- collected within an authentic landfill environment. This dataset provides a realistic representation of
71
- waste items, allowing our model to learn from real-world examples.
72
- """)
73
-
74
- # Problem statement
75
- st.write("#### ⚠️ Problem Statement")
76
- st.warning("""
77
- Manual waste sorting is inefficient, leading to low recycling rates and increased environmental harm.
78
- Our goal is to develop a deep learning-based waste classification system using a Convolutional Neural Network (CNN)
79
- that can accurately classify at least 70% of waste images across 9 material categories. This automated
80
- system aims to significantly improve recycling efficiency and reduce the environmental impact of improper
81
- waste disposal.
82
- """)
83
-
84
- # Project objective
85
- st.write("#### 🎯 Objective")
86
- st.success("""
87
- This project aims to develop a Convolutional Neural Network (CNN) model capable of accurately classifying waste images into nine distinct material types:
88
- 1. Cardboard - e.g., boxes, packaging
89
- 2. Glass - e.g., bottles, jars
90
- 3. Metal - e.g., cans, foil
91
- 4. Paper - e.g., newspapers, magazines
92
- 5. Plastic - e.g., bottles, containers
93
- 6. Miscellaneous Trash - e.g., non-recyclable items
94
- 7. Food Organics - e.g., fruit peels, vegetable scraps
95
- 8. Textile Trash - e.g., old clothes, fabrics
96
- 9. Vegetation - e.g., leaves, branches
97
-
98
- By leveraging deep learning techniques, we seek to automate and improve waste management efficiency, ultimately contributing to environmental sustainability. Our model will analyze visual characteristics such as shape, color, and texture to categorize waste items, helping to streamline recycling processes and reduce the environmental impact of improper waste disposal.
99
-
100
- The successful implementation of this project could lead to:
101
- - Increased recycling rates
102
- - Reduced contamination in recycling streams
103
- - Lower operational costs for waste management facilities
104
- - Enhanced public awareness about proper waste sorting
105
- """)
106
-
107
- elif page == "📊 EDA":
108
- # Run the Exploratory Data Analysis module
109
- eda.run()
110
-
111
- elif page == "🔍 Prediction":
112
- # Run the Prediction module
113
- prediction.run()
114
-
115
- if __name__ == "__main__":
116
  main()
 
1
+ # app.py
2
+
3
+ import streamlit as st
4
+ import eda
5
+ import prediction
6
+
7
+ # Set the page configuration for the Streamlit app
8
+ st.set_page_config(
9
+ page_title="Waste Classification",
10
+ page_icon="♻️",
11
+ layout="wide",
12
+ initial_sidebar_state="expanded"
13
+ )
14
+
15
+ def main():
16
+ # Create a sidebar for navigation
17
+ st.sidebar.title("♻️ Navigation")
18
+ page = st.sidebar.radio("Go to", ["🏠 Home", "📊 EDA", "🔍 Prediction"])
19
+
20
+ if page == "🏠 Home":
21
+ # Add sidebar content for the Home page
22
+ st.sidebar.markdown("---")
23
+ st.sidebar.subheader("📊 About the Model")
24
+ accuracy = 0.82
25
+ st.sidebar.write("🎯 Model Accuracy:")
26
+ st.sidebar.progress(accuracy)
27
+ st.sidebar.write(f"{accuracy:.2%}")
28
+ st.sidebar.write("**🤔 What is Accuracy?**")
29
+ st.sidebar.write("Accuracy measures how well our model correctly classifies waste items.")
30
+ st.sidebar.write("**💡 What does this mean?**")
31
+ st.sidebar.write(f"Our model correctly classifies {accuracy:.2%} of waste items, helping improve recycling efficiency.")
32
+
33
+ st.sidebar.markdown("---")
34
+ st.sidebar.subheader("♻️ Fun Facts")
35
+ # Added more fun facts
36
+ fun_facts = [
37
+ "Proper waste classification can increase recycling rates by up to 50%!",
38
+ "Recycling one aluminum can saves enough energy to run a TV for three hours.",
39
+ "It takes 450 years for a plastic bottle to decompose in a landfill.",
40
+ "Glass can be recycled endlessly without losing quality or purity.",
41
+ "Recycling paper saves 17 trees and 7,000 gallons of water per ton of paper."
42
+ ]
43
+ st.sidebar.info(fun_facts[st.session_state.get('fun_fact_index', 0)])
44
+
45
+ # Button to cycle through fun facts
46
+ if st.sidebar.button("Next Fun Fact"):
47
+ st.session_state['fun_fact_index'] = (st.session_state.get('fun_fact_index', 0) + 1) % len(fun_facts)
48
+ st.rerun()
49
+
50
+ # Main content for the Home page
51
+ st.title("♻️ Welcome to Waste Classification Tool")
52
+ st.write("""
53
+ This application provides functionalities for Exploratory Data Analysis and
54
+ Prediction of waste types. Use the navigation pane on the left to
55
+ select the module you wish to utilize.
56
+ """)
57
+
58
+ # Display an image in the center column
59
+ col1, col2, col3 = st.columns([1,2,1])
60
+ with col2:
61
+ st.image("https://assets-a1.kompasiana.com/items/album/2021/03/14/dr-stone-fandomcom-1536x864-604dff978ede483a3b589c96.png?t=o&v=780",
62
+ caption="Notes: Recycling is crucial for our environment", use_column_width=True)
63
+
64
+ st.markdown("---")
65
+
66
+ # Information about the dataset
67
+ st.write("#### 📊 Dataset")
68
+ st.info("""
69
+ The dataset used is the RealWaste dataset, containing images of waste items across 9 major material types,
70
+ collected within an authentic landfill environment. This dataset provides a realistic representation of
71
+ waste items, allowing our model to learn from real-world examples.
72
+ """)
73
+
74
+ # Problem statement
75
+ st.write("#### ⚠️ Problem Statement")
76
+ st.warning("""
77
+ Manual waste sorting is inefficient, leading to low recycling rates and increased environmental harm.
78
+ Our goal is to develop a deep learning-based waste classification system using a Convolutional Neural Network (CNN)
79
+ that can accurately classify at least 70% of waste images across 9 material categories. This automated
80
+ system aims to significantly improve recycling efficiency and reduce the environmental impact of improper
81
+ waste disposal.
82
+ """)
83
+
84
+ # Project objective
85
+ st.write("#### 🎯 Objective")
86
+ st.success("""
87
+ This project aims to develop a Convolutional Neural Network (CNN) model capable of accurately classifying waste images into nine distinct material types:
88
+ 1. Cardboard - e.g., boxes, packaging
89
+ 2. Glass - e.g., bottles, jars
90
+ 3. Metal - e.g., cans, foil
91
+ 4. Paper - e.g., newspapers, magazines
92
+ 5. Plastic - e.g., bottles, containers
93
+ 6. Miscellaneous Trash - e.g., non-recyclable items
94
+ 7. Food Organics - e.g., fruit peels, vegetable scraps
95
+ 8. Textile Trash - e.g., old clothes, fabrics
96
+ 9. Vegetation - e.g., leaves, branches
97
+
98
+ By leveraging deep learning techniques, we seek to automate and improve waste management efficiency, ultimately contributing to environmental sustainability. Our model will analyze visual characteristics such as shape, color, and texture to categorize waste items, helping to streamline recycling processes and reduce the environmental impact of improper waste disposal.
99
+
100
+ The successful implementation of this project could lead to:
101
+ - Increased recycling rates
102
+ - Reduced contamination in recycling streams
103
+ - Lower operational costs for waste management facilities
104
+ - Enhanced public awareness about proper waste sorting
105
+ """)
106
+
107
+ elif page == "📊 EDA":
108
+ # Run the Exploratory Data Analysis module
109
+ eda.run()
110
+
111
+ elif page == "🔍 Prediction":
112
+ # Run the Prediction module
113
+ prediction.run()
114
+
115
+ if __name__ == "__main__":
116
  main()