Spaces:
Sleeping
Sleeping
Update pages/Life cycle of ML.py
Browse files- 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 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
align-items: center;
|
| 18 |
-
gap: 20px;
|
| 19 |
-
margin-top: 50px;
|
| 20 |
-
flex-wrap: wrap;
|
| 21 |
}
|
| 22 |
-
.
|
| 23 |
background-color: #4CAF50;
|
|
|
|
| 24 |
color: white;
|
| 25 |
-
padding:
|
| 26 |
text-align: center;
|
| 27 |
-
border-radius: 5px;
|
| 28 |
font-size: 16px;
|
| 29 |
-
|
| 30 |
cursor: pointer;
|
| 31 |
-
|
| 32 |
-
transition: all 0.2s ease;
|
| 33 |
}
|
| 34 |
-
.
|
| 35 |
background-color: #45a049;
|
| 36 |
-
transform: scale(1.
|
| 37 |
-
}
|
| 38 |
-
.arrow:after {
|
| 39 |
-
content: "→";
|
| 40 |
-
margin-left: 10px;
|
| 41 |
}
|
| 42 |
-
.
|
| 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 |
-
|
| 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 |
-
|
| 62 |
-
|
| 63 |
|
| 64 |
-
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 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 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
|
| 124 |
-
|
| 125 |
-
|
| 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 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 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 |
-
|
| 154 |
-
|
| 155 |
-
st.write("")
|
| 156 |
-
if st.button("⬅️ Back to Home"):
|
| 157 |
-
navigate_to("home")
|
| 158 |
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
st.
|
| 162 |
-
|
| 163 |
-
|
| 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
|
| 191 |
-
|
|
|
|
|
|
| 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)
|