Mpavan45 commited on
Commit
75c0ea6
Β·
verified Β·
1 Parent(s): 2921e3f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -12
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
- types_of_ml = st.sidebar.radio("πŸ“Š Types of Machine Learning",
234
- ["Select a Type", "Supervised Learning", "Unsupervised Learning", "Reinforcement Learning"])
 
 
 
235
 
236
- # Grouping other topics under a separate section
237
- popular_algorithms = st.sidebar.radio("πŸš€ Popular Algorithms",
238
- ["Select an Algorithm", "Linear Regression", "Logistic Regression", "Decision Trees",
239
- "K-Nearest Neighbors (KNN)", "Support Vector Machines (SVM)", "Neural Networks"])
 
 
 
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 != "Select a Type":
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 != "Select an Algorithm":
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: