Update app.py
Browse files
app.py
CHANGED
|
@@ -226,17 +226,23 @@ def neural_networks():
|
|
| 226 |
# Sidebar for content navigation
|
| 227 |
st.sidebar.header("π Contents")
|
| 228 |
|
| 229 |
-
# Show Introduction first in the sidebar
|
| 230 |
-
intro_option = st.sidebar.radio("π Introduction", ["Introduction", "Select a Topic"])
|
| 231 |
|
| 232 |
-
# Grouping the types of machine learning into one section
|
| 233 |
-
|
| 234 |
-
|
|
|
|
|
|
|
|
|
|
| 235 |
|
| 236 |
-
# Grouping other topics under a separate section
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
|
|
|
|
|
|
|
|
|
| 240 |
|
| 241 |
# Mapping page functions to selection
|
| 242 |
pages = {
|
|
@@ -254,18 +260,18 @@ pages = {
|
|
| 254 |
# Main content area
|
| 255 |
st.markdown("<h1 style='text-align: center; color: orange;'>Machine Learning (ML)</h1>", unsafe_allow_html=True)
|
| 256 |
|
| 257 |
-
# Show the Introduction content first
|
| 258 |
if intro_option == "Introduction":
|
| 259 |
st.markdown(introduction_to_ml())
|
| 260 |
|
| 261 |
# Show content based on the selected type of machine learning or algorithm from the sidebar
|
| 262 |
-
if types_of_ml
|
| 263 |
st.markdown(f"<h2 style='text-align: center; color: orange;'>{types_of_ml}</h2>", unsafe_allow_html=True)
|
| 264 |
content_function = pages.get(types_of_ml, None)
|
| 265 |
if content_function:
|
| 266 |
st.markdown(content_function())
|
| 267 |
|
| 268 |
-
if popular_algorithms
|
| 269 |
st.markdown(f"<h2 style='text-align: center; color: orange;'>{popular_algorithms}</h2>", unsafe_allow_html=True)
|
| 270 |
content_function = pages.get(popular_algorithms, None)
|
| 271 |
if content_function:
|
|
|
|
| 226 |
# Sidebar for content navigation
|
| 227 |
st.sidebar.header("π Contents")
|
| 228 |
|
| 229 |
+
# Show Introduction first in the sidebar (Only display the Introduction option initially)
|
| 230 |
+
intro_option = st.sidebar.radio("π Introduction", ["Introduction", "Select a Topic"], index=0)
|
| 231 |
|
| 232 |
+
# Grouping the types of machine learning into one section (Only after Introduction is selected)
|
| 233 |
+
if intro_option == "Introduction":
|
| 234 |
+
types_of_ml = st.sidebar.radio("π Types of Machine Learning",
|
| 235 |
+
["Supervised Learning", "Unsupervised Learning", "Reinforcement Learning"])
|
| 236 |
+
else:
|
| 237 |
+
types_of_ml = None
|
| 238 |
|
| 239 |
+
# Grouping other topics under a separate section (Only after Introduction is selected)
|
| 240 |
+
if intro_option == "Introduction":
|
| 241 |
+
popular_algorithms = st.sidebar.radio("π Popular Algorithms",
|
| 242 |
+
["Linear Regression", "Logistic Regression", "Decision Trees",
|
| 243 |
+
"K-Nearest Neighbors (KNN)", "Support Vector Machines (SVM)", "Neural Networks"])
|
| 244 |
+
else:
|
| 245 |
+
popular_algorithms = None
|
| 246 |
|
| 247 |
# Mapping page functions to selection
|
| 248 |
pages = {
|
|
|
|
| 260 |
# Main content area
|
| 261 |
st.markdown("<h1 style='text-align: center; color: orange;'>Machine Learning (ML)</h1>", unsafe_allow_html=True)
|
| 262 |
|
| 263 |
+
# Show the Introduction content first (Only show if selected)
|
| 264 |
if intro_option == "Introduction":
|
| 265 |
st.markdown(introduction_to_ml())
|
| 266 |
|
| 267 |
# Show content based on the selected type of machine learning or algorithm from the sidebar
|
| 268 |
+
if types_of_ml:
|
| 269 |
st.markdown(f"<h2 style='text-align: center; color: orange;'>{types_of_ml}</h2>", unsafe_allow_html=True)
|
| 270 |
content_function = pages.get(types_of_ml, None)
|
| 271 |
if content_function:
|
| 272 |
st.markdown(content_function())
|
| 273 |
|
| 274 |
+
if popular_algorithms:
|
| 275 |
st.markdown(f"<h2 style='text-align: center; color: orange;'>{popular_algorithms}</h2>", unsafe_allow_html=True)
|
| 276 |
content_function = pages.get(popular_algorithms, None)
|
| 277 |
if content_function:
|