Update app.py
Browse files
app.py
CHANGED
|
@@ -223,56 +223,51 @@ def neural_networks():
|
|
| 223 |
'''
|
| 224 |
return neural
|
| 225 |
|
|
|
|
| 226 |
# Sidebar for content navigation
|
| 227 |
st.sidebar.header("π Contents")
|
| 228 |
|
| 229 |
-
# Show Introduction first in the sidebar
|
| 230 |
-
|
|
|
|
| 231 |
|
| 232 |
-
#
|
| 233 |
-
if
|
| 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 |
-
|
| 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 = {
|
| 249 |
-
"Supervised Learning": supervised_learning,
|
| 250 |
-
"Unsupervised Learning": unsupervised_learning,
|
| 251 |
-
"Reinforcement Learning": reinforcement_learning,
|
| 252 |
-
"Linear Regression": linear_regression,
|
| 253 |
-
"Logistic Regression": logistic_regression,
|
| 254 |
-
"Decision Trees": decision_trees,
|
| 255 |
-
"K-Nearest Neighbors (KNN)": knn,
|
| 256 |
-
"Support Vector Machines (SVM)": svm,
|
| 257 |
-
"Neural Networks": neural_networks
|
| 258 |
-
}
|
| 259 |
-
|
| 260 |
# Main content area
|
| 261 |
st.markdown("<h1 style='text-align: center; color: orange;'>Machine Learning (ML)</h1>", unsafe_allow_html=True)
|
| 262 |
|
| 263 |
-
#
|
| 264 |
-
if
|
| 265 |
st.markdown(introduction_to_ml())
|
| 266 |
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
st.markdown(
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
'''
|
| 224 |
return neural
|
| 225 |
|
| 226 |
+
# Sidebar for content navigation
|
| 227 |
# Sidebar for content navigation
|
| 228 |
st.sidebar.header("π Contents")
|
| 229 |
|
| 230 |
+
# Show Introduction first in the sidebar
|
| 231 |
+
page = st.sidebar.radio("π Select a Topic",
|
| 232 |
+
["Introduction", "Types of Machine Learning", "Popular Algorithms"])
|
| 233 |
|
| 234 |
+
# Conditional options based on sidebar selection
|
| 235 |
+
if page == "Types of Machine Learning":
|
| 236 |
types_of_ml = st.sidebar.radio("π Types of Machine Learning",
|
| 237 |
["Supervised Learning", "Unsupervised Learning", "Reinforcement Learning"])
|
| 238 |
else:
|
| 239 |
types_of_ml = None
|
| 240 |
|
| 241 |
+
if page == "Popular Algorithms":
|
|
|
|
| 242 |
popular_algorithms = st.sidebar.radio("π Popular Algorithms",
|
| 243 |
["Linear Regression", "Logistic Regression", "Decision Trees",
|
| 244 |
"K-Nearest Neighbors (KNN)", "Support Vector Machines (SVM)", "Neural Networks"])
|
| 245 |
else:
|
| 246 |
popular_algorithms = None
|
| 247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
# Main content area
|
| 249 |
st.markdown("<h1 style='text-align: center; color: orange;'>Machine Learning (ML)</h1>", unsafe_allow_html=True)
|
| 250 |
|
| 251 |
+
# Display content based on the selected page
|
| 252 |
+
if page == "Introduction":
|
| 253 |
st.markdown(introduction_to_ml())
|
| 254 |
|
| 255 |
+
elif types_of_ml == "Supervised Learning":
|
| 256 |
+
st.markdown(supervised_learning())
|
| 257 |
+
elif types_of_ml == "Unsupervised Learning":
|
| 258 |
+
st.markdown(unsupervised_learning())
|
| 259 |
+
elif types_of_ml == "Reinforcement Learning":
|
| 260 |
+
st.markdown(reinforcement_learning())
|
| 261 |
+
|
| 262 |
+
elif popular_algorithms == "Linear Regression":
|
| 263 |
+
st.markdown(linear_regression())
|
| 264 |
+
elif popular_algorithms == "Logistic Regression":
|
| 265 |
+
st.markdown(logistic_regression())
|
| 266 |
+
elif popular_algorithms == "Decision Trees":
|
| 267 |
+
st.markdown(decision_trees())
|
| 268 |
+
elif popular_algorithms == "K-Nearest Neighbors (KNN)":
|
| 269 |
+
st.markdown(knn())
|
| 270 |
+
elif popular_algorithms == "Support Vector Machines (SVM)":
|
| 271 |
+
st.markdown(svm())
|
| 272 |
+
elif popular_algorithms == "Neural Networks":
|
| 273 |
+
st.markdown(neural_networks())
|