Spaces:
Sleeping
Sleeping
Update pages/3_Life cycle of ML.py
Browse files- pages/3_Life cycle of ML.py +57 -37
pages/3_Life cycle of ML.py
CHANGED
|
@@ -1,64 +1,84 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
-
# Initialize session state
|
| 4 |
if "page" not in st.session_state:
|
| 5 |
st.session_state.page = "main"
|
| 6 |
|
|
|
|
| 7 |
def navigate_to(page_name):
|
| 8 |
st.session_state.page = page_name
|
| 9 |
|
|
|
|
| 10 |
if st.session_state.page == "main":
|
| 11 |
-
# Main Page Header
|
| 12 |
st.markdown(
|
| 13 |
"""
|
| 14 |
-
<div style="
|
| 15 |
-
<h2 style="color: #4a90e2; font-family: Arial, sans-serif;">
|
| 16 |
</div>
|
| 17 |
""",
|
| 18 |
unsafe_allow_html=True,
|
| 19 |
)
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
steps =
|
| 23 |
-
"
|
| 24 |
-
"
|
| 25 |
-
"
|
| 26 |
-
"
|
| 27 |
-
"
|
| 28 |
-
"
|
| 29 |
-
"
|
| 30 |
-
"
|
| 31 |
-
"
|
| 32 |
-
"
|
| 33 |
-
|
| 34 |
|
| 35 |
-
#
|
| 36 |
-
step = st.selectbox("Select a step in the ML life cycle:", list(steps.keys()))
|
| 37 |
-
st.write(f"**{step}**: {steps[step]}")
|
| 38 |
-
|
| 39 |
-
# Navigation Button
|
| 40 |
-
if step == "2. Data Collection":
|
| 41 |
-
if st.button("Learn More About Data Collection"):
|
| 42 |
-
navigate_to("data_collection")
|
| 43 |
-
|
| 44 |
-
# Custom Style
|
| 45 |
st.markdown(
|
| 46 |
"""
|
| 47 |
<style>
|
| 48 |
-
.
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
cursor: pointer;
|
| 56 |
-
transition:
|
| 57 |
}
|
| 58 |
-
.
|
| 59 |
-
background-color: #
|
| 60 |
}
|
| 61 |
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
""",
|
| 63 |
unsafe_allow_html=True,
|
| 64 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
+
# Initialize session state
|
| 4 |
if "page" not in st.session_state:
|
| 5 |
st.session_state.page = "main"
|
| 6 |
|
| 7 |
+
# Function to navigate between pages
|
| 8 |
def navigate_to(page_name):
|
| 9 |
st.session_state.page = page_name
|
| 10 |
|
| 11 |
+
# Page content
|
| 12 |
if st.session_state.page == "main":
|
|
|
|
| 13 |
st.markdown(
|
| 14 |
"""
|
| 15 |
+
<div style="text-align: center; margin-top: 20px;">
|
| 16 |
+
<h2 style="color: #4a90e2; font-family: Arial, sans-serif;">Machine Learning Project Life Cycle</h2>
|
| 17 |
</div>
|
| 18 |
""",
|
| 19 |
unsafe_allow_html=True,
|
| 20 |
)
|
| 21 |
|
| 22 |
+
# Life cycle steps with descriptions
|
| 23 |
+
steps = [
|
| 24 |
+
("Problem Statement", "Define the aim/goal of the ML model."),
|
| 25 |
+
("Data Collection", "Gather data from sources like APIs, web scraping, or Kaggle."),
|
| 26 |
+
("Simple EDA", "Quickly explore the data for missing values and outliers."),
|
| 27 |
+
("Data Pre-Processing", "Clean and transform the data for model readiness."),
|
| 28 |
+
("EDA", "Visualize and analyze data for deeper insights."),
|
| 29 |
+
("Feature Engineering", "Create new features to enhance model performance."),
|
| 30 |
+
("Training the Model", "Use the prepared dataset to train the model."),
|
| 31 |
+
("Testing the Data", "Evaluate the model's performance on test data."),
|
| 32 |
+
("Deployment", "Deploy the model for real-world usage."),
|
| 33 |
+
("Monitoring", "Monitor and update the model to maintain performance."),
|
| 34 |
+
]
|
| 35 |
|
| 36 |
+
# Display steps as buttons in a grid layout
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
st.markdown(
|
| 38 |
"""
|
| 39 |
<style>
|
| 40 |
+
.grid-container {
|
| 41 |
+
display: grid;
|
| 42 |
+
grid-template-columns: repeat(2, 1fr);
|
| 43 |
+
gap: 20px;
|
| 44 |
+
margin: 20px;
|
| 45 |
+
}
|
| 46 |
+
.grid-item {
|
| 47 |
+
background-color: #f0f0f5;
|
| 48 |
+
border: 1px solid #ddd;
|
| 49 |
+
border-radius: 8px;
|
| 50 |
+
padding: 20px;
|
| 51 |
+
text-align: center;
|
| 52 |
cursor: pointer;
|
| 53 |
+
transition: all 0.3s ease;
|
| 54 |
}
|
| 55 |
+
.grid-item:hover {
|
| 56 |
+
background-color: #e8e8f0;
|
| 57 |
}
|
| 58 |
</style>
|
| 59 |
+
<div class="grid-container">
|
| 60 |
+
""" +
|
| 61 |
+
"".join([f'<div class="grid-item" onclick="window.location.href='#{step[0].replace(" ", "-")}';">{step[0]}</div>' for step in steps]) +
|
| 62 |
+
"</div>"
|
| 63 |
""",
|
| 64 |
unsafe_allow_html=True,
|
| 65 |
)
|
| 66 |
+
|
| 67 |
+
# Display description for the selected step
|
| 68 |
+
selected_step = st.selectbox("Select a step to learn more:", [step[0] for step in steps])
|
| 69 |
+
st.write(f"### {selected_step}")
|
| 70 |
+
for step in steps:
|
| 71 |
+
if step[0] == selected_step:
|
| 72 |
+
st.write(step[1])
|
| 73 |
+
break
|
| 74 |
+
|
| 75 |
+
# Navigation for detailed pages
|
| 76 |
+
if selected_step == "Data Collection" and st.button("Learn More About Data Collection"):
|
| 77 |
+
navigate_to("data_collection")
|
| 78 |
+
|
| 79 |
+
elif st.session_state.page == "data_collection":
|
| 80 |
+
st.title("Data Collection")
|
| 81 |
+
st.write("Here you can provide detailed content about data collection methods.")
|
| 82 |
+
if st.button("Back to Main Page"):
|
| 83 |
+
navigate_to("main")
|
| 84 |
+
|