Harika22 commited on
Commit
4728983
·
verified ·
1 Parent(s): ec750b0

Update pages/Life cycle of ML.py

Browse files
Files changed (1) hide show
  1. pages/Life cycle of ML.py +69 -166
pages/Life cycle of ML.py CHANGED
@@ -1,191 +1,94 @@
1
  import streamlit as st
2
  from graphviz import Digraph
3
 
4
- if "current_page" not in st.session_state:
5
- st.session_state.current_page = "home"
6
-
7
- def navigate_to(page):
8
- st.session_state.current_page = page
9
-
10
- # Custom CSS for styling
11
- def add_custom_css():
12
- st.markdown("""
13
- <style>
14
- .arrow-container {
15
- display: flex;
16
- justify-content: center;
17
- align-items: center;
18
- gap: 20px;
19
- margin-top: 50px;
20
- flex-wrap: wrap;
21
  }
22
- .arrow {
23
  background-color: #4CAF50;
 
24
  color: white;
25
- padding: 10px 20px;
26
  text-align: center;
27
- border-radius: 5px;
28
  font-size: 16px;
29
- font-weight: bold;
30
  cursor: pointer;
31
- box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
32
- transition: all 0.2s ease;
33
  }
34
- .arrow:hover {
35
  background-color: #45a049;
36
- transform: scale(1.1);
37
- }
38
- .arrow:after {
39
- content: "→";
40
- margin-left: 10px;
41
  }
42
- .arrow:last-child:after {
43
- content: "";
44
- }
45
- .back-btn {
46
- margin-top: 20px;
47
- background-color: #007BFF;
48
- color: white;
49
- padding: 10px 20px;
50
  text-align: center;
51
- border-radius: 5px;
52
- font-size: 16px;
53
- cursor: pointer;
54
- box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
55
- transition: all 0.2s ease;
56
- }
57
- .back-btn:hover {
58
- background-color: #0056b3;
59
- transform: scale(1.1);
60
  }
61
- </style>
62
- """, unsafe_allow_html=True)
63
 
64
- graph = Digraph()
65
 
66
- graph.edges([
67
- ("Problem Statement", "Data Collection"),
68
- ("Data Collection", "Simple EDA"),
69
- ("Simple EDA", "Data Pre-Processing"),
70
- ("Data Pre-Processing", "EDA"),
71
- ("EDA", "Feature Engineering"),
72
- ("Feature Engineering", "Model Training"),
73
- ("Model Training", "Testing"),
74
- ("Testing", "Deployement and maintenance"),
75
- ])
76
- st.graphviz_chart(graph)
77
-
78
- def home_page():
79
- st.title("🚀 Machine Learning Lifecycle")
80
-
81
- st.markdown('<div class="arrow-container">', unsafe_allow_html=True)
82
- if st.button("1. Problem Statement", key="problem_statement"):
83
- navigate_to("problem_definition")
84
- if st.button("2. Data Collection", key="data_collection"):
85
- navigate_to("data_collection")
86
- if st.button("3. Simple EDA", key="simple_eda"):
87
- navigate_to("simple_eda")
88
- if st.button("4. Data Pre-processing", key="data_pre_processing"):
89
- navigate_to("data_pre_processing")
90
- if st.button("5. EDA", key="eda"):
91
- navigate_to("eda")
92
- if st.button("6. Feature Engineering", key="feature_engineering"):
93
- navigate_to("feature_engineering")
94
- if st.button("7. Training Model", key="training_model"):
95
- navigate_to("training_model")
96
- if st.button("8. Testing", key="testing"):
97
- navigate_to("testing")
98
- if st.button("9. Deployment", key="deployment"):
99
- navigate_to("deployment")
100
- if st.button("10. Monitoring", key="monitoring"):
101
- navigate_to("monitoring")
102
- st.markdown('</div>', unsafe_allow_html=True)
103
 
104
- def problem_statement_page():
105
- st.title("📌 Problem Statement")
106
- st.write()
107
- st.markdown('<div class="back-btn" onclick="location.href=\'#\'">⬅️ Back to Home</div>', unsafe_allow_html=True)
108
- if st.button("⬅️ Back to Home"):
109
- navigate_to("home")
 
 
 
 
 
110
 
111
- def data_collection_page():
112
- st.title("📊 Data Collection")
113
- st.write("")
114
- if st.button("⬅️ Back to Home"):
115
- navigate_to("home")
 
 
 
 
 
 
116
 
117
- def simple_eda_page():
118
- st.title("🔧 Simple EDA")
119
- st.write("")
120
- if st.button("⬅️ Back to Home"):
121
- navigate_to("home")
122
 
123
- def data_pre_processing_page():
124
- st.title("🤖 Data Pre-processing")
125
- st.write("")
126
- if st.button("⬅️ Back to Home"):
127
- navigate_to("home")
128
 
129
- def eda_page():
130
- st.title("📈 EDA")
131
- st.write("")
132
- if st.button("⬅️ Back to Home"):
133
- navigate_to("home")
134
 
135
- def feature_engineering_page():
136
- st.title("🌐Feature Engineering")
137
- st.write("")
138
- if st.button("⬅️ Back to Home"):
139
- navigate_to("home")
140
-
141
- def training_model_page():
142
- st.title("Training Model")
143
- st.write("")
144
- if st.button("⬅️ Back to Home"):
145
- navigate_to("home")
146
-
147
- def testing_page():
148
- st.title("🌐Testing")
149
- st.write("")
150
- if st.button("⬅️ Back to Home"):
151
- navigate_to("home")
152
 
153
- def deployment_page():
154
- st.title("🔧Deployment")
155
- st.write("")
156
- if st.button("⬅️ Back to Home"):
157
- navigate_to("home")
158
 
159
- def monitoring_page():
160
- st.title("🤖Monitoring")
161
- st.write("")
162
- if st.button("⬅️ Back to Home"):
163
- navigate_to("home")
164
- def main():
165
- add_custom_css()
166
-
167
- if st.session_state.current_page == "home":
168
- home_page()
169
- elif st.session_state.current_page == "problem_statement":
170
- problem_statement_page()
171
- elif st.session_state.current_page == "data_collection":
172
- data_collection_page()
173
- elif st.session_state.current_page == "simple_eda":
174
- simple_eda_page()
175
- elif st.session_state.current_page == "data_pre_processing":
176
- data_pre_processing_page()
177
- elif st.session_state.current_page == "eda":
178
- eda_page()
179
- elif st.session_state.current_page == "feature_engineering":
180
- feature_engineering_page()
181
- elif st.session_state.current_page == "training_model":
182
- training_model_page()
183
- elif st.session_state.current_page == "testing":
184
- testing_page()
185
- elif st.session_state.current_page == "deployment":
186
- deployment_page()
187
- elif st.session_state.current_page == "monitoring":
188
- monitoring_page()
189
 
190
- if __name__ == "__main__":
191
- main()
 
 
1
  import streamlit as st
2
  from graphviz import Digraph
3
 
4
+ custom_css = """
5
+ <style>
6
+ html, body, [data-testid="stAppViewContainer"] {
7
+ background: linear-gradient(to right, #f8fbff, #eef2f3);
8
+ font-family: 'Arial', sans-serif;
9
+ color: #333;
10
+ }
11
+ h1 {
12
+ color: #34495e;
13
+ text-align: center;
14
+ font-size: 2.8rem;
15
+ margin-top: 20px;
16
+ text-shadow: 1px 1px 3px rgba(200, 200, 255, 0.8);
 
 
 
 
17
  }
18
+ .stButton button {
19
  background-color: #4CAF50;
20
+ border: none;
21
  color: white;
22
+ padding: 12px 24px;
23
  text-align: center;
 
24
  font-size: 16px;
25
+ border-radius: 8px;
26
  cursor: pointer;
27
+ transition: background-color 0.3s ease, transform 0.3s ease;
 
28
  }
29
+ .stButton button:hover {
30
  background-color: #45a049;
31
+ transform: scale(1.05);
 
 
 
 
32
  }
33
+ .stMarkdown {
 
 
 
 
 
 
 
34
  text-align: center;
35
+ margin-top: 10px;
 
 
 
 
 
 
 
 
36
  }
37
+ </style>
38
+ """
39
 
40
+ st.markdown(custom_css, unsafe_allow_html=True)
41
 
42
+ st.markdown("<h1>🚀 Lifecycle of an ML Project</h1>", unsafe_allow_html=True)
43
+
44
+ st.markdown("<p style='text-align:center;'>Explore each phase of the ML lifecycle by clicking on the buttons below.</p>", unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
+ steps = [
47
+ "Problem Statement",
48
+ "Data Collection",
49
+ "Simple EDA",
50
+ "Data Pre-Processing",
51
+ "EDA",
52
+ "Feature Engineering",
53
+ "Model Training",
54
+ "Testing",
55
+ "Deployment and Maintenance"
56
+ ]
57
 
58
+ descriptions = {
59
+ "Problem Statement": "Objective of the project.",
60
+ "Data Collection": "Collecting data from various sources.",
61
+ "Simple EDA": "Describing the quality of the data.",
62
+ "Data Pre-Processing": "Removing unnecessary data like missing and null values.",
63
+ "EDA": "Transforming insights into a clean dataset and providing proper visualizations.",
64
+ "Feature Engineering": "Creating and analyzing features and labels.",
65
+ "Model Training": "Training the machine about relationships between features and labels.",
66
+ "Testing": "Testing how efficiently the machine learned.",
67
+ "Deployment and Maintenance": "Deploying the machine to the client and ensuring maintenance for accurate results."
68
+ }
69
 
 
 
 
 
 
70
 
71
+ graph = Digraph(engine="neato", format="svg")
72
+ graph.attr(splines="true", nodesep="0.8", ranksep="1.2", rankdir="LR")
73
+ graph.attr("node", shape="ellipse", style="filled", color="#b3cde0", fontname="Arial", fontsize="12")
 
 
74
 
 
 
 
 
 
75
 
76
+ for i, step in enumerate(steps):
77
+ graph.node(str(i), step)
78
+ if i < len(steps) - 1:
79
+ graph.edge(str(i), str(i+1), color="#34495e", penwidth="2", arrowhead="vee", arrowsize="1.2")
80
+
81
+ st.graphviz_chart(graph)
 
 
 
 
 
 
 
 
 
 
 
82
 
83
+ st.markdown("<hr>", unsafe_allow_html=True)
84
+ st.markdown("<div style='text-align:center; font-size:1.2rem;'>Select a phase to learn more:</div>", unsafe_allow_html=True)
 
 
 
85
 
86
+ selected_step = None
87
+ for step in steps:
88
+ if st.button(step):
89
+ selected_step = step
90
+ break
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
+ if selected_step:
93
+ st.markdown(f"<h2>{selected_step}</h2>", unsafe_allow_html=True)
94
+ st.markdown(f"<p style='font-size:1.1rem; text-align:center;'>{descriptions[selected_step]}</p>", unsafe_allow_html=True)