Harika22 commited on
Commit
4ee8d4c
·
verified ·
1 Parent(s): 41aa354

Update pages/3_Life cycle of ML.py

Browse files
Files changed (1) hide show
  1. pages/3_Life cycle of ML.py +75 -54
pages/3_Life cycle of ML.py CHANGED
@@ -1,49 +1,65 @@
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",
@@ -52,42 +68,47 @@ steps = [
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)
 
1
  import streamlit as st
 
2
 
3
+ # Custom CSS for styling
4
  custom_css = """
5
  <style>
6
  html, body, [data-testid="stAppViewContainer"] {
7
+ background: linear-gradient(
8
+ rgba(255, 255, 255, 0.9),
9
+ rgba(200, 200, 255, 0.8)
10
+ ),
11
+ url('https://i.imgur.com/vIszbgs.jpeg') no-repeat center center fixed;
12
+ background-size: cover;
13
+ font-family: Arial, sans-serif;
14
+ color: #333333;
15
  }
16
  h1 {
17
+ color: #2c3e50;
18
  text-align: center;
19
+ font-size: 3rem;
20
  margin-top: 20px;
21
+ text-shadow: 1px 1px 3px rgba(255, 255, 255, 0.8);
22
  }
23
+ .circle-container {
24
+ display: flex;
25
+ justify-content: center;
26
+ flex-wrap: wrap;
27
+ gap: 20px;
28
+ margin-top: 30px;
29
+ }
30
+ .circle-button {
31
+ width: 100px;
32
+ height: 100px;
33
+ border-radius: 50%;
34
  background-color: #4CAF50;
35
+ display: flex;
36
+ justify-content: center;
37
+ align-items: center;
38
  color: white;
 
 
39
  font-size: 16px;
40
+ text-align: center;
41
  cursor: pointer;
42
+ transition: transform 0.2s ease-in-out, background-color 0.2s ease-in-out;
43
  }
44
+ .circle-button:hover {
45
  background-color: #45a049;
46
+ transform: scale(1.1);
47
  }
48
+ .selected {
49
+ background-color: #2c3e50 !important;
 
50
  }
51
  </style>
52
  """
53
 
54
+ # Apply CSS
55
  st.markdown(custom_css, unsafe_allow_html=True)
56
 
57
+ # Title
58
+ st.markdown("<h1>ML Project Lifecycle</h1>", unsafe_allow_html=True)
59
+ st.write("Click on a lifecycle step below to learn more.")
60
 
61
+ # Lifecycle stages
62
+ stages = [
63
  "Problem Statement",
64
  "Data Collection",
65
  "Simple EDA",
 
68
  "Feature Engineering",
69
  "Model Training",
70
  "Testing",
71
+ "Deployment",
72
+ "Maintenance",
73
  ]
74
 
75
+ # Descriptions for each stage
76
+ stage_descriptions = {
77
+ "Problem Statement": "Define the objective and scope of the project.",
78
+ "Data Collection": "Gather data from various reliable sources.",
79
+ "Simple EDA": "Summarize and understand the quality of the data.",
80
+ "Data Pre-Processing": "Clean and prepare the data by removing noise.",
81
+ "EDA": "Visualize and analyze data to uncover patterns.",
82
+ "Feature Engineering": "Create, transform, and select features for modeling.",
83
+ "Model Training": "Train the ML model using prepared data.",
84
+ "Testing": "Evaluate the model's performance and accuracy.",
85
+ "Deployment": "Integrate the model into a production environment.",
86
+ "Maintenance": "Monitor and update the model to ensure performance.",
87
  }
88
 
89
+ # State management for the selected stage
90
+ if "selected_stage" not in st.session_state:
91
+ st.session_state.selected_stage = None
92
 
93
+ # Display lifecycle steps as circular buttons
94
+ st.markdown('<div class="circle-container">', unsafe_allow_html=True)
95
+ for stage in stages:
96
+ is_selected = st.session_state.selected_stage == stage
97
+ btn_class = "circle-button selected" if is_selected else "circle-button"
98
+ if st.markdown(
99
+ f"""
100
+ <div class="{btn_class}" onclick="window.parent.streamlit.runOnClick({repr(stage)})">
101
+ {stage}
102
+ </div>
103
+ """,
104
+ unsafe_allow_html=True,
105
+ ):
106
+ st.session_state.selected_stage = stage
107
+ st.markdown('</div>', unsafe_allow_html=True)
108
 
109
+ # Display description of the selected stage
110
+ if st.session_state.selected_stage:
111
+ selected_stage = st.session_state.selected_stage
112
+ st.markdown(f"### {selected_stage}")
113
+ st.write(stage_descriptions[selected_stage])
114