Update app.py
Browse files
app.py
CHANGED
|
@@ -225,8 +225,24 @@ def neural_networks():
|
|
| 225 |
|
| 226 |
|
| 227 |
# Call the function to display the image
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
|
| 229 |
-
#
|
| 230 |
st.sidebar.header("π Contents")
|
| 231 |
st.sidebar.markdown("""
|
| 232 |
- π [Introduction](#Introduction-to-Machine-Learning-ML)
|
|
@@ -243,41 +259,15 @@ st.sidebar.markdown("""
|
|
| 243 |
- π§ [Neural Networks](#Neural-Networks)
|
| 244 |
""")
|
| 245 |
|
| 246 |
-
#
|
| 247 |
st.markdown("<h1 style='text-align: center; color: orange;'>Machine Learning (ML)</h1>", unsafe_allow_html=True)
|
| 248 |
st.markdown(generate_ml_blog())
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
"K-Nearest Neighbors (KNN)",
|
| 258 |
-
"Support Vector Machines (SVM)",
|
| 259 |
-
"Neural Networks"
|
| 260 |
-
])
|
| 261 |
-
if st.sidebar.radio == "Introduction":
|
| 262 |
-
st.markdown("<h1 style='text-align: center; color: orange;'>Machine Learning (ML)</h1>", unsafe_allow_html=True)
|
| 263 |
-
st.markdown("<h2 style='text-align: center; color: orange;'>Introduction</h2>", unsafe_allow_html=True)
|
| 264 |
-
st.markdown(introduction_to_ml())
|
| 265 |
-
elif st.sidebar.radio == "Supervised Learning":
|
| 266 |
-
st.markdown(supervised_learning())
|
| 267 |
-
elif st.sidebar.radio == "Unsupervised Learning":
|
| 268 |
-
st.markdown(unsupervised_learning())
|
| 269 |
-
elif st.sidebar.radio == "Reinforcement Learning":
|
| 270 |
-
st.markdown(reinforcement_learning())
|
| 271 |
-
elif st.sidebar.radio == "Linear Regression":
|
| 272 |
-
st.markdown(linear_regression())
|
| 273 |
-
elif st.sidebar.radio == "Logistic Regression":
|
| 274 |
-
st.markdown(logistic_regression())
|
| 275 |
-
elif st.sidebar.radio == "Decision Trees":
|
| 276 |
-
st.markdown(decision_trees())
|
| 277 |
-
elif st.sidebar.radio == "K-Nearest Neighbors (KNN)":
|
| 278 |
-
st.markdown(knn())
|
| 279 |
-
elif st.sidebar.radio == "Support Vector Machines (SVM)":
|
| 280 |
-
st.markdown(svm())
|
| 281 |
-
elif st.sidebar.radio == "Neural Networks":
|
| 282 |
-
st.markdown(neural_networks())
|
| 283 |
|
|
|
|
| 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 |
+
# Define a dictionary to map page names to functions
|
| 232 |
+
pages = {
|
| 233 |
+
"Introduction": introduction_to_ml,
|
| 234 |
+
"Supervised Learning": supervised_learning,
|
| 235 |
+
"Unsupervised Learning": unsupervised_learning,
|
| 236 |
+
"Reinforcement Learning": reinforcement_learning,
|
| 237 |
+
"Linear Regression": linear_regression,
|
| 238 |
+
"Logistic Regression": logistic_regression,
|
| 239 |
+
"Decision Trees": decision_trees,
|
| 240 |
+
"K-Nearest Neighbors (KNN)": knn,
|
| 241 |
+
"Support Vector Machines (SVM)": svm,
|
| 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)
|
|
|
|
| 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 |
+
# Sidebar radio button to select the page
|
| 267 |
+
selected_page = st.sidebar.radio("Select Section", list(pages.keys()))
|
| 268 |
+
|
| 269 |
+
# Display the content based on the selected page
|
| 270 |
+
st.markdown(f"<h2 style='text-align: center; color: orange;'>{selected_page}</h2>", unsafe_allow_html=True)
|
| 271 |
+
content_function = pages[selected_page] # Get the corresponding function
|
| 272 |
+
st.markdown(content_function())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
|