LakshmiHarika commited on
Commit
a5a4c94
·
verified ·
1 Parent(s): 0c7ef36

Update pages/3Life Cycle of Machine Learning Project.py

Browse files
pages/3Life Cycle of Machine Learning Project.py CHANGED
@@ -1,8 +1,7 @@
1
  import streamlit as st
2
 
3
- # Set up the Streamlit page configuration
4
  st.set_page_config(
5
- page_title="ML Project Lifecycle",
6
  page_icon="🚀",
7
  layout="wide"
8
  )
@@ -10,179 +9,161 @@ st.set_page_config(
10
  # Global CSS for consistent styling across all pages
11
  st.markdown("""
12
  <style>
13
- body {
14
- font-family: Arial, sans-serif;
15
- display: flex;
16
- justify-content: center;
17
- align-items: center;
18
- height: 100vh;
19
- margin: 0;
20
- background-color: #f4f4f9;
21
  }
22
- .container {
23
- text-align: center;
24
- width: 80%;
25
- max-width: 800px;
26
  }
27
- .circle {
28
- position: relative;
29
- width: 350px;
30
- height: 350px;
31
- margin: 20px auto;
32
- border-radius: 50%;
33
- display: flex;
34
- justify-content: center;
35
- align-items: center;
36
  }
37
- .steps {
38
- position: absolute;
39
- width: 100%;
40
- height: 100%;
41
- display: flex;
42
- justify-content: center;
43
- align-items: center;
44
- flex-wrap: wrap;
45
- }
46
- .step {
47
- background-color: #007bff;
48
- color: white;
49
- padding: 15px 30px;
50
- border-radius: 8px;
51
- cursor: pointer;
52
- width: 150px;
53
- margin: 10px;
54
- text-align: center;
55
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
56
- transition: background-color 0.3s;
57
- position: absolute;
58
- transform-origin: 50% 50%;
59
- transition: transform 0.5s ease-in-out;
60
- }
61
- .step:hover {
62
- background-color: #0056b3;
63
- }
64
- /* Different background colors for each step */
65
- #step1 {
66
- background-color: #ff5733;
67
- transform: rotate(0deg) translateX(140px) rotate(0deg);
68
- }
69
- #step2 {
70
- background-color: #33b5ff;
71
- transform: rotate(36deg) translateX(140px) rotate(-36deg);
72
- }
73
- #step3 {
74
- background-color: #33ff57;
75
- transform: rotate(72deg) translateX(140px) rotate(-72deg);
76
- }
77
- #step4 {
78
- background-color: #ff33cc;
79
- transform: rotate(108deg) translateX(140px) rotate(-108deg);
80
- }
81
- #step5 {
82
- background-color: #ffcc33;
83
- transform: rotate(144deg) translateX(140px) rotate(-144deg);
84
- }
85
- #step6 {
86
- background-color: #33ccff;
87
- transform: rotate(180deg) translateX(140px) rotate(-180deg);
88
- }
89
- #step7 {
90
- background-color: #ff33a1;
91
- transform: rotate(216deg) translateX(140px) rotate(-216deg);
92
- }
93
- #step8 {
94
- background-color: #66ff33;
95
- transform: rotate(252deg) translateX(140px) rotate(-252deg);
96
- }
97
- #step9 {
98
- background-color: #9933ff;
99
- transform: rotate(288deg) translateX(140px) rotate(-288deg);
100
- }
101
- #step10 {
102
- background-color: #f7a500;
103
- transform: rotate(324deg) translateX(140px) rotate(-324deg);
104
- }
105
- /* Rotate steps to form a circular layout */
106
- #step4 {
107
- transform: rotate(0deg) translateX(250px) rotate(0deg);
108
- }
109
- #step5 {
110
- transform: rotate(25deg) translateX(250px) rotate(-25deg);
111
- }
112
- #step6 {
113
- transform: rotate(60deg) translateX(250px) rotate(-60deg);
114
- }
115
- #step7 {
116
- transform: rotate(120deg) translateX(250px) rotate(-120deg);
117
- }
118
- #step8 {
119
- transform: rotate(155deg) translateX(250px) rotate(-155deg);
120
- }
121
- #step9 {
122
- transform: rotate(180deg) translateX(250px) rotate(-180deg);
123
- }
124
- #step10 {
125
- transform: rotate(205deg) translateX(250px) rotate(-205deg);
126
- }
127
- #step1 {
128
- transform: rotate(240deg) translateX(250px) rotate(-240deg);
129
- }
130
- #step2 {
131
- transform: rotate(300deg) translateX(250px) rotate(-300deg);
132
- }
133
- #step3 {
134
- transform: rotate(335deg) translateX(250px) rotate(-335deg);
135
- }
136
- a {
137
- color: white; /* Link color */
138
- text-decoration: none;
139
- }
140
- a:hover {
141
- color: yellow; /* Color on hover */
142
- text-decoration: underline; /* Underline on hover */
143
  }
144
  </style>
145
  """, unsafe_allow_html=True)
146
 
147
- # HTML structure for the circular flowchart
148
  st.markdown(
149
  """
150
- <div class="container">
151
- <h1>ML Project Life Cycle</h1>
152
- <div class="circle">
153
- <div class="steps">
154
- <div class="step" id="step1">1. Problem Statement</div>
155
- <div class="step" id="step2">2. Data Collection</div>
156
- <div class="step" id="step3">3. Simple EDA</div>
157
- <div class="step" id="step4">4. Data Pre-Processing</div>
158
- <div class="step" id="step5">5. EDA</div>
159
- <div class="step" id="step6">6. Feature Engineering</div>
160
- <div class="step" id="step7">7. Training the Model</div>
161
- <div class="step" id="step8">8. Testing the Data</div>
162
- <div class="step" id="step9">9. Deployment</div>
163
- <div class="step" id="step10">10. Monitoring</div>
164
- </div>
165
- </div>
166
- </div>
167
- """, unsafe_allow_html=True
168
  )
169
 
170
- # Define descriptions for each phase
171
- descriptions = {
172
- '1. Problem Statement' : "Clearly define the issue, the data used, and the expected outcome.",
173
- '2. Data Collection': "Collect relevant data from various sources like APIs, databases, and user-generated content.",
174
- '3. Simple EDA': "Perform initial exploratory analysis to assess data quality, structure, and appearance.",
175
- '4. Data Pre-Processing': "Clean the dataset by handling missing values, outliers, and inconsistencies.",
176
- '5. EDA': "Perform detailed analysis to uncover trends, patterns, and relationships in the data.",
177
- '6. Feature Engineering': "Create or select meaningful features, scale variables, and reduce dimensionality.",
178
- '7. Training the Model': "Train machine learning models on the prepared dataset and optimize parameters.",
179
- '8. Testing the Data': "Evaluate the trained model on a validation dataset to assess performance.",
180
- '9. Deployment': "Deploy the model into a live system for real-time or batch processing of new data.",
181
- '10. Monitoring': "Track model performance, handling issues like data drift and model degradation."
182
- }
183
 
184
- # Create a navigation menu using a selectbox
185
- step = st.selectbox('Select a step in the machine learning life cycle:', list(descriptions.keys()))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
 
187
- # Display the description for the selected step
188
- st.write(descriptions[step])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
 
 
3
  st.set_page_config(
4
+ page_title="HomePage",
5
  page_icon="🚀",
6
  layout="wide"
7
  )
 
9
  # Global CSS for consistent styling across all pages
10
  st.markdown("""
11
  <style>
12
+ body, .stApp {
13
+ color: #4F4F4F; /* Replace with your desired font color */
14
+ background-color: #FFFFFF; /* Optional: Set a fixed background color */
 
 
 
 
 
15
  }
16
+ h1, h2, h3, h4, h5, h6 {
17
+ color: #BB3385; /* Replace with your heading color */
 
 
18
  }
19
+ p {
20
+ color: #4F4F4F; /* Replace with your paragraph text color */
 
 
 
 
 
 
 
21
  }
22
+ ul li {
23
+ color: #4F4F4F; /* List item color */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  }
25
  </style>
26
  """, unsafe_allow_html=True)
27
 
 
28
  st.markdown(
29
  """
30
+ <style>
31
+ .stApp {
32
+ background-image: url("https://huggingface.co/spaces/LakshmiHarika/MachineLearning/resolve/main/DALL%C2%B7E%202024-12-03%2023.34.47%20-%20A%20simple%20and%20elegant%20background%20image%20for%20an%20AI-themed%20web%20application.%20The%20background%20should%20feature%20a%20soft%20gradient%20transitioning%20from%20white%20to%20ligh.webp");
33
+ background-size: cover;
34
+ background-repeat: no-repeat;
35
+ background-attachment: fixed;
36
+ }
37
+ </style>
38
+ """,
39
+ unsafe_allow_html=True
 
 
 
 
 
 
 
 
40
  )
41
 
42
+ # Title of the page
43
+ st.markdown("""<div style="text-align: center; margin-top: 20px;"><h1 style="color: #BB3385;">Life Cycle of End to End ML Project</h1></div>""", unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
44
 
45
+ # Inject custom CSS for the circular flowchart
46
+ st.markdown(
47
+ """
48
+ <style>
49
+ .circular-flowchart {
50
+ position: relative;
51
+ width: 500px;
52
+ height: 500px;
53
+ margin: 0 auto;
54
+ display: flex;
55
+ justify-content: center;
56
+ align-items: center;
57
+ border-radius: 50%;
58
+ position: relative;
59
+ }
60
+ .phase-container {
61
+ position: absolute;
62
+ top: 50%;
63
+ left: 50%;
64
+ width: 100%;
65
+ height: 100%;
66
+ transform: translate(-50%, -50%);
67
+ }
68
+ .phase {
69
+ position: absolute;
70
+ width: 250px; /* Rectangle width */
71
+ height: 60px; /* Rectangle height */
72
+ border-radius: 8px; /* Rounded edges */
73
+ font-size: 16px; /* Text size */
74
+ font-weight: bold;
75
+ text-align: center;
76
+ cursor: pointer;
77
+ font-family: Arial, sans-serif;
78
+ display: flex;
79
+ justify-content: center;
80
+ align-items: center;
81
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
82
+ transition: transform 0.3s ease, background-color 0.3s ease;
83
+ color: black; /* Always black text */
84
+ }
85
+ .phase-1 { background-color: #E6F4EA; } /* Light Green */
86
+ .phase-2 { background-color: #E0F7FA; } /* Light Blue */
87
+ .phase-3 { background-color: #FFF9C4; } /* Light Yellow */
88
+ .phase-4 { background-color: #FFE0B2; } /* Light Orange */
89
+ .phase-5 { background-color: #DCEDC8; } /* Light Green */
90
+ .phase-6 { background-color: #D1C4E9; } /* Light Purple */
91
+ .phase-7 { background-color: #F8BBD0; } /* Light Pink */
92
+ .phase-8 { background-color: #CFD8DC; } /* Light Gray-Blue */
93
+ .phase-9 { background-color: #B2EBF2; } /* Light Cyan */
94
+ .phase-10 { background-color: #FFE082; } /* Light Amber */
95
 
96
+ .phase:hover {
97
+ transform: scale(1.05);
98
+ background-color: #F0F0F0; /* Slightly lighter on hover */
99
+ color: black; /* Ensure text remains black */
100
+ }
101
+
102
+ /* Styling for descriptions */
103
+ .description {
104
+ display: none; /* Hidden by default */
105
+ width: 250px;
106
+ margin-top: -10px;
107
+ background-color: #F9F9F9;
108
+ color: #333;
109
+ font-size: 14px;
110
+ border-radius: 5px;
111
+ padding: 10px;
112
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
113
+ }
114
+ </style>
115
+ """,
116
+ unsafe_allow_html=True
117
+ )
118
+
119
+ # HTML structure for the circular flowchart with descriptions
120
+ st.markdown(
121
+ """
122
+ <div class="circular-flowchart">
123
+ <div class="phase-container">
124
+ <!-- Problem Statement -->
125
+ <a href="javascript:void(0)" class="phase phase-1" onclick="toggleDescription('desc1')" style="transform: rotate(0deg) translateY(-230px);">Problem Statement</a>
126
+ <div id="desc1" class="description">Clearly define the issue, the data used, and the expected outcome.</div>
127
+ <!-- Data Collection -->
128
+ <a href="javascript:void(0)" class="phase phase-2" onclick="toggleDescription('desc2')" style="transform: rotate(36deg) translateY(-230px);">Data Collection</a>
129
+ <div id="desc2" class="description">Collect relevant data from multiple sources, ensuring it aligns with the problem statement.</div>
130
+ <!-- Simple EDA -->
131
+ <a href="javascript:void(0)" class="phase phase-3" onclick="toggleDescription('desc3')" style="transform: rotate(72deg) translateY(-230px);">Simple EDA</a>
132
+ <div id="desc3" class="description">Perform initial exploratory analysis to assess data quality, structure, and appearance.</div>
133
+ <!-- Data Preprocessing -->
134
+ <a href="javascript:void(0)" class="phase phase-4" onclick="toggleDescription('desc4')" style="transform: rotate(108deg) translateY(-230px);">Data Preprocessing</a>
135
+ <div id="desc4" class="description">Clean the dataset by handling missing values, outliers, and inconsistencies, transforming it into a suitable format.</div>
136
+ <!-- EDA -->
137
+ <a href="javascript:void(0)" class="phase phase-5" onclick="toggleDescription('desc5')" style="transform: rotate(144deg) translateY(-230px);">EDA</a>
138
+ <div id="desc5" class="description">Perform detailed analysis to uncover trends, patterns, and relationships that will guide model building.</div>
139
+ <!-- Feature Engineering -->
140
+ <a href="javascript:void(0)" class="phase phase-6" onclick="toggleDescription('desc6')" style="transform: rotate(180deg) translateY(-230px);">Feature Engineering</a>
141
+ <div id="desc6" class="description">Create or select meaningful features, scale variables, and reduce dimensionality to enhance model performance.</div>
142
+ <!-- Model Training -->
143
+ <a href="javascript:void(0)" class="phase phase-7" onclick="toggleDescription('desc7')" style="transform: rotate(216deg) translateY(-230px);">Model Training</a>
144
+ <div id="desc7" class="description">Train machine learning models on the prepared data and optimize parameters for improved performance.</div>
145
+ <!-- Model Testing -->
146
+ <a href="javascript:void(0)" class="phase phase-8" onclick="toggleDescription('desc8')" style="transform: rotate(252deg) translateY(-230px);">Model Testing</a>
147
+ <div id="desc8" class="description">Evaluate the trained model on a validation or test dataset to assess accuracy, precision, and other metrics.</div>
148
+ <!-- Deployment -->
149
+ <a href="javascript:void(0)" class="phase phase-9" onclick="toggleDescription('desc9')" style="transform: rotate(288deg) translateY(-230px);">Deployment</a>
150
+ <div id="desc9" class="description">Deploy the trained model into a live system for real-time or batch processing of new data.</div>
151
+ <!-- Monitoring -->
152
+ <a href="javascript:void(0)" class="phase phase-10" onclick="toggleDescription('desc10')" style="transform: rotate(324deg) translateY(-230px);">Monitoring</a>
153
+ <div id="desc10" class="description">Track model performance in production, addressing issues like data drift and performance degradation.</div>
154
+ </div>
155
+ </div>
156
+
157
+ <script>
158
+ function toggleDescription(id) {
159
+ var desc = document.getElementById(id);
160
+ if (desc.style.display === "block") {
161
+ desc.style.display = "none";
162
+ } else {
163
+ desc.style.display = "block";
164
+ }
165
+ }
166
+ </script>
167
+ """,
168
+ unsafe_allow_html=True
169
+ )