Mpavan45 commited on
Commit
448a667
Β·
verified Β·
1 Parent(s): 11d94a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +75 -26
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
- # Define a dictionary to map page names to functions
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
- # 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
 
 
 
 
 
 
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
+