Spaces:
Sleeping
Sleeping
Update pages/3_Life cycle of ML.py
Browse files- pages/3_Life cycle of ML.py +68 -60
pages/3_Life cycle of ML.py
CHANGED
|
@@ -1,85 +1,93 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from graphviz import Digraph
|
| 3 |
|
| 4 |
-
# Custom CSS for circular buttons
|
| 5 |
custom_css = """
|
| 6 |
<style>
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
background-color: #4CAF50;
|
| 11 |
-
color: white;
|
| 12 |
-
font-size: 14px;
|
| 13 |
-
font-weight: bold;
|
| 14 |
border: none;
|
| 15 |
-
|
|
|
|
| 16 |
text-align: center;
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
display: inline-block;
|
| 20 |
cursor: pointer;
|
| 21 |
-
|
| 22 |
}
|
| 23 |
-
.
|
| 24 |
background-color: #45a049;
|
|
|
|
| 25 |
}
|
| 26 |
-
.
|
| 27 |
-
display: flex;
|
| 28 |
-
justify-content: center;
|
| 29 |
-
align-items: center;
|
| 30 |
-
flex-wrap: wrap;
|
| 31 |
-
}
|
| 32 |
-
.arrow {
|
| 33 |
-
font-size: 24px;
|
| 34 |
-
color: #2c3e50;
|
| 35 |
text-align: center;
|
| 36 |
-
margin:
|
| 37 |
}
|
| 38 |
</style>
|
| 39 |
"""
|
| 40 |
|
| 41 |
-
# Apply custom CSS
|
| 42 |
st.markdown(custom_css, unsafe_allow_html=True)
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
st.
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
"
|
| 51 |
-
"EDA",
|
| 52 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
]
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
"
|
| 57 |
-
"
|
| 58 |
-
"
|
| 59 |
-
"
|
| 60 |
-
"
|
| 61 |
-
"
|
| 62 |
-
"
|
| 63 |
-
"
|
| 64 |
-
"Deployment and Maintenance": "
|
| 65 |
}
|
| 66 |
|
| 67 |
-
# Generate Graphviz Circular Diagram
|
| 68 |
-
def generate_graph():
|
| 69 |
-
dot = Digraph()
|
| 70 |
-
dot.attr(rankdir="LR", size="8,8", layout="circo")
|
| 71 |
-
for i, step in enumerate(lifecycle_steps):
|
| 72 |
-
dot.node(f"{i+1}", step)
|
| 73 |
-
for i in range(len(lifecycle_steps)):
|
| 74 |
-
dot.edge(f"{i+1}", f"{(i+1) % len(lifecycle_steps) + 1}")
|
| 75 |
-
return dot
|
| 76 |
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
-
|
| 80 |
-
st.markdown("<
|
| 81 |
-
|
| 82 |
-
if st.button(step, key=step):
|
| 83 |
-
st.write(f"### {step}")
|
| 84 |
-
st.write(lifecycle_descriptions[step])
|
| 85 |
-
st.markdown("</div>", unsafe_allow_html=True)
|
|
|
|
| 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": "It is a technique by which we can convert raw data into pre-procesed data --->1.Clean the data 2.Transform the data",
|
| 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 |
+
|
| 85 |
+
selected_step = None
|
| 86 |
+
for step in steps:
|
| 87 |
+
if st.button(step):
|
| 88 |
+
selected_step = step
|
| 89 |
+
break
|
| 90 |
|
| 91 |
+
if selected_step:
|
| 92 |
+
st.markdown(f"<h2>{selected_step}</h2>", unsafe_allow_html=True)
|
| 93 |
+
st.markdown(f"<p style='font-size:1.1rem; text-align:center;'>{descriptions[selected_step]}</p>", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|