Harika22 commited on
Commit
1bea722
Β·
verified Β·
1 Parent(s): 6ecb60b

Update pages/Life cycle of ML.py

Browse files
Files changed (1) hide show
  1. pages/Life cycle of ML.py +164 -0
pages/Life cycle of ML.py CHANGED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ # Custom CSS styling
4
+ def add_custom_css():
5
+ st.markdown(
6
+ """
7
+ <style>
8
+ body {
9
+ font-family: 'Arial', sans-serif;
10
+ background-color: #f7f9fc;
11
+ }
12
+ .title {
13
+ text-align: center;
14
+ font-size: 2.5rem;
15
+ color: #1f77b4;
16
+ font-weight: bold;
17
+ margin-bottom: 20px;
18
+ }
19
+ .subtitle {
20
+ text-align: center;
21
+ font-size: 1.5rem;
22
+ color: #555555;
23
+ margin-top: -15px;
24
+ margin-bottom: 30px;
25
+ }
26
+ .button-container {
27
+ display: flex;
28
+ justify-content: space-evenly;
29
+ margin: 20px 0;
30
+ }
31
+ .stage-button {
32
+ background-color: #1f77b4;
33
+ color: white;
34
+ border: none;
35
+ border-radius: 8px;
36
+ padding: 10px 20px;
37
+ font-size: 1.2rem;
38
+ cursor: pointer;
39
+ text-transform: uppercase;
40
+ transition: background-color 0.3s ease;
41
+ }
42
+ .stage-button:hover {
43
+ background-color: #145a86;
44
+ }
45
+ .back-button {
46
+ background-color: #ff6347;
47
+ color: white;
48
+ border: none;
49
+ border-radius: 8px;
50
+ padding: 10px 20px;
51
+ font-size: 1rem;
52
+ cursor: pointer;
53
+ margin-top: 20px;
54
+ transition: background-color 0.3s ease;
55
+ }
56
+ .back-button:hover {
57
+ background-color: #d9534f;
58
+ }
59
+ </style>
60
+ """,
61
+ unsafe_allow_html=True,
62
+ )
63
+
64
+ # Functions for each page
65
+ def home_page():
66
+ st.markdown("<div class='title'>Machine Learning Lifecycle</div>", unsafe_allow_html=True)
67
+ st.markdown("<div class='subtitle'>Explore the stages of an ML project!</div>", unsafe_allow_html=True)
68
+
69
+ st.image("https://via.placeholder.com/800x400?text=ML+Lifecycle", caption="Visual Representation of ML Lifecycle")
70
+
71
+ st.markdown(
72
+ """
73
+ <div class="button-container">
74
+ <button class="stage-button" onclick="location.href='?page=problem_definition'">1. Problem Definition</button>
75
+ <button class="stage-button" onclick="location.href='?page=data_collection'">2. Data Collection</button>
76
+ <button class="stage-button" onclick="location.href='?page=data_preparation'">3. Data Preparation</button>
77
+ </div>
78
+ <div class="button-container">
79
+ <button class="stage-button" onclick="location.href='?page=modeling'">4. Modeling</button>
80
+ <button class="stage-button" onclick="location.href='?page=evaluation'">5. Evaluation</button>
81
+ <button class="stage-button" onclick="location.href='?page=deployment'">6. Deployment</button>
82
+ </div>
83
+ """,
84
+ unsafe_allow_html=True,
85
+ )
86
+
87
+ def problem_definition_page():
88
+ st.markdown("<div class='title'>🎯 Problem Definition</div>", unsafe_allow_html=True)
89
+ st.write("Define the problem your machine learning model aims to solve.")
90
+ st.image("https://via.placeholder.com/600x300?text=Define+Problem", caption="Example: Problem Definition")
91
+ st.markdown(
92
+ "<button class='back-button' onclick=\"location.href='?page=home'\">Back to Home</button>",
93
+ unsafe_allow_html=True,
94
+ )
95
+
96
+ def data_collection_page():
97
+ st.markdown("<div class='title'>πŸ“Š Data Collection</div>", unsafe_allow_html=True)
98
+ st.write("Gather data relevant to the problem and verify data sources.")
99
+ st.image("https://via.placeholder.com/600x300?text=Data+Collection", caption="Data Sources Overview")
100
+ st.markdown(
101
+ "<button class='back-button' onclick=\"location.href='?page=home'\">Back to Home</button>",
102
+ unsafe_allow_html=True,
103
+ )
104
+
105
+ def data_preparation_page():
106
+ st.markdown("<div class='title'>πŸ”„ Data Preparation</div>", unsafe_allow_html=True)
107
+ st.write("Preprocess, clean, and split the data into train, validation, and test sets.")
108
+ st.image("https://via.placeholder.com/600x300?text=Data+Preparation", caption="Data Preparation Overview")
109
+ st.markdown(
110
+ "<button class='back-button' onclick=\"location.href='?page=home'\">Back to Home</button>",
111
+ unsafe_allow_html=True,
112
+ )
113
+
114
+ def modeling_page():
115
+ st.markdown("<div class='title'>πŸ€– Modeling</div>", unsafe_allow_html=True)
116
+ st.write("Train machine learning models and tune hyperparameters.")
117
+ st.image("https://via.placeholder.com/600x300?text=Modeling", caption="Model Training Visualization")
118
+ st.markdown(
119
+ "<button class='back-button' onclick=\"location.href='?page=home'\">Back to Home</button>",
120
+ unsafe_allow_html=True,
121
+ )
122
+
123
+ def evaluation_page():
124
+ st.markdown("<div class='title'>βœ… Evaluation</div>", unsafe_allow_html=True)
125
+ st.write("Evaluate model performance using standard metrics.")
126
+ st.image("https://via.placeholder.com/600x300?text=Evaluation", caption="Evaluation Metrics Overview")
127
+ st.markdown(
128
+ "<button class='back-button' onclick=\"location.href='?page=home'\">Back to Home</button>",
129
+ unsafe_allow_html=True,
130
+ )
131
+
132
+ def deployment_page():
133
+ st.markdown("<div class='title'>πŸš€ Deployment</div>", unsafe_allow_html=True)
134
+ st.write("Deploy your model for real-world use.")
135
+ st.image("https://via.placeholder.com/600x300?text=Deployment+Pipeline", caption="Deployment Pipeline")
136
+ st.markdown(
137
+ "<button class='back-button' onclick=\"location.href='?page=home'\">Back to Home</button>",
138
+ unsafe_allow_html=True,
139
+ )
140
+
141
+ def main():
142
+ add_custom_css()
143
+ query_params = st.experimental_get_query_params()
144
+ page = query_params.get("page", ["home"])[0]
145
+
146
+ if page == "home":
147
+ home_page()
148
+ elif page == "problem_definition":
149
+ problem_definition_page()
150
+ elif page == "data_collection":
151
+ data_collection_page()
152
+ elif page == "data_preparation":
153
+ data_preparation_page()
154
+ elif page == "modeling":
155
+ modeling_page()
156
+ elif page == "evaluation":
157
+ evaluation_page()
158
+ elif page == "deployment":
159
+ deployment_page()
160
+ else:
161
+ st.error("Page not found!")
162
+
163
+ if __name__ == "__main__":
164
+ main()