James McCool commited on
Commit
346309d
Β·
1 Parent(s): cd997d2

Refactor streamlit_app.py to replace sport selection with a segmented control for tab navigation, enhancing UI clarity. Update button functionality for NHL updates and add placeholders for NFL, NBA, and MLB updates.

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +26 -26
src/streamlit_app.py CHANGED
@@ -42,9 +42,6 @@ st.title("πŸ† Paydirt Model Updates")
42
  st.markdown("### Update models and generate seed frames")
43
  st.markdown("---")
44
 
45
- # Sidebar Configuration
46
- st.sidebar.header("βš™οΈ Configuration")
47
-
48
  # Sport Selection
49
  sport_icons = {
50
  "NHL": "πŸ’",
@@ -53,20 +50,20 @@ sport_icons = {
53
  "MLB": "⚾"
54
  }
55
 
56
- selected_sport = st.sidebar.selectbox(
57
- "Select Sport",
58
- options=["NHL", "NFL", "NBA", "MLB"],
59
- format_func=lambda x: f"{sport_icons[x]} {x}",
60
- help="Choose which sport to update"
 
 
 
61
  )
62
 
63
  # Main content area
64
- st.info(f"Click the button below to start {selected_sport} model update process")
65
 
66
- if st.button(f"{sport_icons[selected_sport]} Update {selected_sport} models and generate seed frames", type="primary", use_container_width=True):
67
-
68
- # Route to sport-specific pipeline
69
- if selected_sport == "NHL":
70
 
71
  st.write("Starting prop betting table generation...")
72
  build_prop_betting_table(nhl_db)
@@ -232,17 +229,20 @@ if st.button(f"{sport_icons[selected_sport]} Update {selected_sport} models and
232
  except:
233
  pass
234
 
235
- st.success("βœ… NHL lineup generation completed successfully!")
236
- st.balloons()
237
-
238
- elif selected_sport == "NFL":
239
- run_nfl_pipeline(nhl_db, gc, gc2, discord)
240
-
241
- elif selected_sport == "NBA":
242
- run_nba_pipeline(nhl_db, gc, gc2, discord)
243
-
244
- elif selected_sport == "MLB":
245
- run_mlb_pipeline(nhl_db, gc, gc2, discord)
246
 
247
- # Close Mongonhl_db connection
248
- client.close()
 
 
 
 
 
 
 
 
 
42
  st.markdown("### Update models and generate seed frames")
43
  st.markdown("---")
44
 
 
 
 
45
  # Sport Selection
46
  sport_icons = {
47
  "NHL": "πŸ’",
 
50
  "MLB": "⚾"
51
  }
52
 
53
+ selected_tab = st.segmented_control(
54
+ "Select Tab",
55
+ options=["NHL Updates", "NBA Updates", 'MLB Updates', 'NFL Updates'],
56
+ selection_mode='single',
57
+ default='NHL Updates',
58
+ width='stretch',
59
+ label_visibility='collapsed',
60
+ key='tab_selector'
61
  )
62
 
63
  # Main content area
64
+ if selected_tab == "NHL Updates":
65
 
66
+ if st.button(f"{sport_icons["NHL"]} Update NHL models and generate seed frames", type="primary", use_container_width=True):
 
 
 
67
 
68
  st.write("Starting prop betting table generation...")
69
  build_prop_betting_table(nhl_db)
 
229
  except:
230
  pass
231
 
232
+ st.success("βœ… NHL updates completed successfully!")
233
+ st.balloons()
234
+
235
+ if selected_tab == "NFL Updates":
236
+ st.info("NFL updates coming soon!")
237
+ st.write("NFL functionality will be added in a future update.")
 
 
 
 
 
238
 
239
+ if selected_tab == "NBA Updates":
240
+ st.info("NBA updates coming soon!")
241
+ st.write("NBA functionality will be added in a future update.")
242
+
243
+ if selected_tab == "MLB Updates":
244
+ st.info("MLB updates coming soon!")
245
+ st.write("MLB functionality will be added in a future update.")
246
+
247
+ # Close Mongonhl_db connection
248
+ client.close()