Update app.py
Browse files
app.py
CHANGED
|
@@ -224,11 +224,64 @@ def neural_networks():
|
|
| 224 |
return neural
|
| 225 |
|
| 226 |
|
| 227 |
-
# Call the function to display the image
|
| 228 |
-
st.markdown("<h1 style='text-align: center; color: orange;'>Machine Learning (ML)</h1>", unsafe_allow_html=True)
|
| 229 |
-
st.markdown(generate_ml_blog())
|
| 230 |
|
| 231 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
pages = {
|
| 233 |
"Introduction": introduction_to_ml,
|
| 234 |
"Supervised Learning": supervised_learning,
|
|
@@ -242,32 +295,28 @@ pages = {
|
|
| 242 |
"Neural Networks": neural_networks
|
| 243 |
}
|
| 244 |
|
| 245 |
-
# Sidebar for content navigation
|
| 246 |
-
st.sidebar.header("π Contents")
|
| 247 |
-
st.sidebar.markdown("""
|
| 248 |
-
- π [Introduction](#Introduction-to-Machine-Learning-ML)
|
| 249 |
-
- π§ [Types of Machine Learning](#Types-of-Machine-Learning)
|
| 250 |
-
- π [Supervised Learning](#Supervised-Learning)
|
| 251 |
-
- π [Unsupervised Learning](#Unsupervised-Learning)
|
| 252 |
-
- πΉοΈ [Reinforcement Learning](#Reinforcement-Learning)
|
| 253 |
-
- π [Popular Algorithms](#Popular-Machine-Learning-Algorithms)
|
| 254 |
-
- π§ [Linear Regression](#Linear-Regression)
|
| 255 |
-
- βοΈ [Logistic Regression](#Logistic-Regression)
|
| 256 |
-
- π³ [Decision Trees](#Decision-Trees)
|
| 257 |
-
- π [K-Nearest Neighbors (KNN)](#K-Nearest-Neighbors-KNN)
|
| 258 |
-
- βοΈ [Support Vector Machines (SVM)](#Support-Vector-Machines-SVM)
|
| 259 |
-
- π§ [Neural Networks](#Neural-Networks)
|
| 260 |
-
""")
|
| 261 |
-
|
| 262 |
# Main content area
|
| 263 |
st.markdown("<h1 style='text-align: center; color: orange;'>Machine Learning (ML)</h1>", unsafe_allow_html=True)
|
| 264 |
st.markdown(generate_ml_blog())
|
| 265 |
|
| 266 |
-
#
|
| 267 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
|
| 269 |
-
#
|
| 270 |
-
st.markdown(f"<h2 style='text-align: center; color: orange;'>{
|
| 271 |
-
content_function = pages[
|
| 272 |
st.markdown(content_function())
|
| 273 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
return neural
|
| 225 |
|
| 226 |
|
|
|
|
|
|
|
|
|
|
| 227 |
|
| 228 |
+
|
| 229 |
+
import streamlit as st
|
| 230 |
+
|
| 231 |
+
# Define page functions (Make sure these functions are defined elsewhere in your code)
|
| 232 |
+
def introduction_to_ml():
|
| 233 |
+
st.title("Introduction to Machine Learning (ML)")
|
| 234 |
+
# Add content for the Introduction page
|
| 235 |
+
|
| 236 |
+
def supervised_learning():
|
| 237 |
+
st.title("Supervised Learning")
|
| 238 |
+
# Add content for Supervised Learning
|
| 239 |
+
|
| 240 |
+
def unsupervised_learning():
|
| 241 |
+
st.title("Unsupervised Learning")
|
| 242 |
+
# Add content for Unsupervised Learning
|
| 243 |
+
|
| 244 |
+
def reinforcement_learning():
|
| 245 |
+
st.title("Reinforcement Learning")
|
| 246 |
+
# Add content for Reinforcement Learning
|
| 247 |
+
|
| 248 |
+
def linear_regression():
|
| 249 |
+
st.title("Linear Regression")
|
| 250 |
+
# Add content for Linear Regression
|
| 251 |
+
|
| 252 |
+
def logistic_regression():
|
| 253 |
+
st.title("Logistic Regression")
|
| 254 |
+
# Add content for Logistic Regression
|
| 255 |
+
|
| 256 |
+
def decision_trees():
|
| 257 |
+
st.title("Decision Trees")
|
| 258 |
+
# Add content for Decision Trees
|
| 259 |
+
|
| 260 |
+
def knn():
|
| 261 |
+
st.title("K-Nearest Neighbors (KNN)")
|
| 262 |
+
# Add content for K-Nearest Neighbors
|
| 263 |
+
|
| 264 |
+
def svm():
|
| 265 |
+
st.title("Support Vector Machines (SVM)")
|
| 266 |
+
# Add content for SVM
|
| 267 |
+
|
| 268 |
+
def neural_networks():
|
| 269 |
+
st.title("Neural Networks")
|
| 270 |
+
# Add content for Neural Networks
|
| 271 |
+
|
| 272 |
+
# Sidebar for content navigation
|
| 273 |
+
st.sidebar.header("π Contents")
|
| 274 |
+
|
| 275 |
+
# Grouping the types of machine learning into one section
|
| 276 |
+
types_of_ml = st.sidebar.radio("π Types of Machine Learning",
|
| 277 |
+
["Supervised Learning", "Unsupervised Learning", "Reinforcement Learning"])
|
| 278 |
+
|
| 279 |
+
# Grouping other topics under a separate section
|
| 280 |
+
popular_algorithms = st.sidebar.radio("π Popular Algorithms",
|
| 281 |
+
["Linear Regression", "Logistic Regression", "Decision Trees",
|
| 282 |
+
"K-Nearest Neighbors (KNN)", "Support Vector Machines (SVM)", "Neural Networks"])
|
| 283 |
+
|
| 284 |
+
# Mapping page functions to selection
|
| 285 |
pages = {
|
| 286 |
"Introduction": introduction_to_ml,
|
| 287 |
"Supervised Learning": supervised_learning,
|
|
|
|
| 295 |
"Neural Networks": neural_networks
|
| 296 |
}
|
| 297 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
# Main content area
|
| 299 |
st.markdown("<h1 style='text-align: center; color: orange;'>Machine Learning (ML)</h1>", unsafe_allow_html=True)
|
| 300 |
st.markdown(generate_ml_blog())
|
| 301 |
|
| 302 |
+
# Use the selected type of machine learning or algorithm to show the content
|
| 303 |
+
if types_of_ml in pages:
|
| 304 |
+
pages[types_of_ml]()
|
| 305 |
+
|
| 306 |
+
if popular_algorithms in pages:
|
| 307 |
+
pages[popular_algorithms]()
|
| 308 |
+
|
| 309 |
+
# Display the page content based on the selected page
|
| 310 |
+
st.markdown(f"<h2 style='text-align: center; color: orange;'>{types_of_ml}</h2>", unsafe_allow_html=True)
|
| 311 |
+
content_function = pages[types_of_ml] # Get the corresponding function
|
| 312 |
+
st.markdown(content_function())
|
| 313 |
|
| 314 |
+
# Alternatively, display the popular algorithms' content as well
|
| 315 |
+
st.markdown(f"<h2 style='text-align: center; color: orange;'>{popular_algorithms}</h2>", unsafe_allow_html=True)
|
| 316 |
+
content_function = pages[popular_algorithms] # Get the corresponding function
|
| 317 |
st.markdown(content_function())
|
| 318 |
|
| 319 |
+
|
| 320 |
+
|
| 321 |
+
|
| 322 |
+
|