Spaces:
Running
Running
James McCool
commited on
Commit
·
5d8edb1
1
Parent(s):
c971f24
Improve UI organization by adding expander sections for filters in each tab
Browse filesRefactor the UI layout for tabs 1-4 by:
- Wrapping filter and reset options in collapsible expander sections
- Maintaining existing functionality while improving visual clarity
- Reducing initial screen clutter by hiding filter controls
app.py
CHANGED
|
@@ -229,12 +229,13 @@ t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
|
| 229 |
tab1, tab2, tab3, tab4, tab5, tab6 = st.tabs(["Game Betting Model", 'Prop Market', "Player Projections", "Prop Trend Table", "Player Prop Simulations", "Stat Specific Simulations"])
|
| 230 |
|
| 231 |
with tab1:
|
| 232 |
-
st.
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
|
|
|
| 238 |
team_frame = game_model
|
| 239 |
if line_var1 == 'Percentage':
|
| 240 |
team_frame = team_frame[['Team', 'Opp', 'PD Team Points', 'PD Opp Points', 'VEG Team Points', 'VEG Opp Points', 'PD Proj Total', 'VEG Proj Total', 'PD Over%', 'PD Under%', 'PD Proj Winner', 'PD Proj Spread', 'PD W Spread', 'VEG W Spread', 'PD Win%']]
|
|
@@ -254,12 +255,13 @@ with tab1:
|
|
| 254 |
)
|
| 255 |
|
| 256 |
with tab2:
|
| 257 |
-
st.
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
|
|
|
| 263 |
disp_market = market_props.copy()
|
| 264 |
disp_market = disp_market[disp_market['PropType'] == market_type]
|
| 265 |
disp_market['No_Vig_Prop'] = disp_market.apply(calculate_no_vig, axis=1)
|
|
@@ -289,16 +291,17 @@ with tab2:
|
|
| 289 |
)
|
| 290 |
|
| 291 |
with tab3:
|
| 292 |
-
st.
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
|
|
|
| 302 |
player_stats = player_stats[player_stats['Team'].isin(team_var1)]
|
| 303 |
player_stats_disp = player_stats.set_index('Player')
|
| 304 |
player_stats_disp = player_stats_disp.sort_values(by='Fantasy', ascending=False)
|
|
@@ -311,22 +314,23 @@ with tab3:
|
|
| 311 |
)
|
| 312 |
|
| 313 |
with tab4:
|
| 314 |
-
st.
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
|
|
|
| 330 |
prop_frame_disp = prop_frame[prop_frame['Team'].isin(team_var5)]
|
| 331 |
prop_frame_disp = prop_frame_disp[prop_frame_disp['book'].isin(book_var5)]
|
| 332 |
prop_frame_disp = prop_frame_disp[prop_frame_disp['prop_type'] == prop_type_var2]
|
|
|
|
| 229 |
tab1, tab2, tab3, tab4, tab5, tab6 = st.tabs(["Game Betting Model", 'Prop Market', "Player Projections", "Prop Trend Table", "Player Prop Simulations", "Stat Specific Simulations"])
|
| 230 |
|
| 231 |
with tab1:
|
| 232 |
+
with st.expander("Info and Filters"):
|
| 233 |
+
st.info(t_stamp)
|
| 234 |
+
if st.button("Reset Data", key='reset1'):
|
| 235 |
+
st.cache_data.clear()
|
| 236 |
+
game_model, raw_baselines, player_stats, prop_frame, pick_frame, market_props, timestamp = init_baselines()
|
| 237 |
+
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
| 238 |
+
line_var1 = st.radio('How would you like to display odds?', options = ['Percentage', 'American'], key='line_var1')
|
| 239 |
team_frame = game_model
|
| 240 |
if line_var1 == 'Percentage':
|
| 241 |
team_frame = team_frame[['Team', 'Opp', 'PD Team Points', 'PD Opp Points', 'VEG Team Points', 'VEG Opp Points', 'PD Proj Total', 'VEG Proj Total', 'PD Over%', 'PD Under%', 'PD Proj Winner', 'PD Proj Spread', 'PD W Spread', 'VEG W Spread', 'PD Win%']]
|
|
|
|
| 255 |
)
|
| 256 |
|
| 257 |
with tab2:
|
| 258 |
+
with st.expander("Info and Filters"):
|
| 259 |
+
st.info(t_stamp)
|
| 260 |
+
if st.button("Reset Data", key='reset2'):
|
| 261 |
+
st.cache_data.clear()
|
| 262 |
+
game_model, raw_baselines, player_stats, prop_frame, pick_frame, market_props, timestamp = init_baselines()
|
| 263 |
+
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
| 264 |
+
market_type = st.selectbox('Select type of prop are you wanting to view', options = prop_table_options, key = 'market_type_key')
|
| 265 |
disp_market = market_props.copy()
|
| 266 |
disp_market = disp_market[disp_market['PropType'] == market_type]
|
| 267 |
disp_market['No_Vig_Prop'] = disp_market.apply(calculate_no_vig, axis=1)
|
|
|
|
| 291 |
)
|
| 292 |
|
| 293 |
with tab3:
|
| 294 |
+
with st.expander("Info and Filters"):
|
| 295 |
+
st.info(t_stamp)
|
| 296 |
+
if st.button("Reset Data", key='reset3'):
|
| 297 |
+
st.cache_data.clear()
|
| 298 |
+
game_model, raw_baselines, player_stats, prop_frame, pick_frame, market_props, timestamp = init_baselines()
|
| 299 |
+
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
| 300 |
+
split_var1 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var1')
|
| 301 |
+
if split_var1 == 'Specific Teams':
|
| 302 |
+
team_var1 = st.multiselect('Which teams would you like to include in the tables?', options = player_stats['Team'].unique(), key='team_var1')
|
| 303 |
+
elif split_var1 == 'All':
|
| 304 |
+
team_var1 = player_stats.Team.values.tolist()
|
| 305 |
player_stats = player_stats[player_stats['Team'].isin(team_var1)]
|
| 306 |
player_stats_disp = player_stats.set_index('Player')
|
| 307 |
player_stats_disp = player_stats_disp.sort_values(by='Fantasy', ascending=False)
|
|
|
|
| 314 |
)
|
| 315 |
|
| 316 |
with tab4:
|
| 317 |
+
with st.expander("Info and Filters"):
|
| 318 |
+
st.info(t_stamp)
|
| 319 |
+
if st.button("Reset Data", key='reset4'):
|
| 320 |
+
st.cache_data.clear()
|
| 321 |
+
game_model, raw_baselines, player_stats, prop_frame, pick_frame, market_props, timestamp = init_baselines()
|
| 322 |
+
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
| 323 |
+
split_var5 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var5')
|
| 324 |
+
if split_var5 == 'Specific Teams':
|
| 325 |
+
team_var5 = st.multiselect('Which teams would you like to include in the tables?', options = player_stats['Team'].unique(), key='team_var5')
|
| 326 |
+
elif split_var5 == 'All':
|
| 327 |
+
team_var5 = player_stats.Team.values.tolist()
|
| 328 |
+
book_split5 = st.radio("Would you like to view all books or specific ones?", ('All', 'Specific Books'), key='book_split5')
|
| 329 |
+
if book_split5 == 'Specific Books':
|
| 330 |
+
book_var5 = st.multiselect('Which books would you like to include in the tables?', options = ['BET_365', 'DRAFTKINGS', 'CONSENSUS', 'FANDUEL', 'MGM', 'UNIBET', 'WILLIAM_HILL'], key='book_var5')
|
| 331 |
+
elif book_split5 == 'All':
|
| 332 |
+
book_var5 = ['BET_365', 'DRAFTKINGS', 'CONSENSUS', 'FANDUEL', 'MGM', 'UNIBET', 'WILLIAM_HILL']
|
| 333 |
+
prop_type_var2 = st.selectbox('Select type of prop are you wanting to view', options = prop_table_options)
|
| 334 |
prop_frame_disp = prop_frame[prop_frame['Team'].isin(team_var5)]
|
| 335 |
prop_frame_disp = prop_frame_disp[prop_frame_disp['book'].isin(book_var5)]
|
| 336 |
prop_frame_disp = prop_frame_disp[prop_frame_disp['prop_type'] == prop_type_var2]
|