James McCool commited on
Commit
adbaf0a
·
1 Parent(s): 779f835

Refactor app.py to enhance the layout by using containers and columns for user input, allowing for simultaneous selection of view and model types, and improving the organization of the display logic for scoring percentages, player ROO, and optimals.

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -121,11 +121,15 @@ def convert_df(array):
121
  roo_data, sd_roo_data, scoring_percentages = init_baselines()
122
  hold_display = roo_data
123
 
124
- view_var = st.radio("Select view", ["Simple", "Advanced"])
125
-
126
- tab1, tab2, tab3 = st.tabs(["Scoring Percentages", "Player ROO", "Optimals"])
127
-
128
- with tab1:
 
 
 
 
129
  with st.expander("Info and Filters"):
130
  col1, col2, col3, col4 = st.columns([3, 3, 3, 3])
131
  with col1:
@@ -150,8 +154,8 @@ with tab1:
150
  elif view_var == "Advanced":
151
  st.dataframe(scoring_percentages.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(game_format, precision=2), height=750, use_container_width = True, hide_index=True)
152
 
153
- with tab2:
154
- st.title("Player ROO")
155
  with st.expander("Info and Filters"):
156
  col1, col2, col3, col4, col5 = st.columns([3, 3, 3, 3, 3])
157
  with col1:
@@ -213,7 +217,8 @@ with tab2:
213
  elif view_var == "Advanced":
214
  st.dataframe(st.session_state['player_roo'].style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), height=750, use_container_width = True, hide_index=True)
215
 
216
- with tab3:
 
217
  with st.expander("Info and Filters"):
218
  if st.button("Load/Reset Data", key='reset3'):
219
  st.cache_data.clear()
 
121
  roo_data, sd_roo_data, scoring_percentages = init_baselines()
122
  hold_display = roo_data
123
 
124
+ with st.container():
125
+ col1, col2 = st.columns([3, 3])
126
+ with col1:
127
+ view_var = st.radio("Select view", ["Simple", "Advanced"])
128
+ with col2:
129
+ model_var = st.radio("What model do you want to view?", ('Scoring Percentages', 'Player ROO', 'Optimals'), key='model_var')
130
+
131
+ if model_var == 'Scoring Percentages':
132
+ st.header("Scoring Percentages")
133
  with st.expander("Info and Filters"):
134
  col1, col2, col3, col4 = st.columns([3, 3, 3, 3])
135
  with col1:
 
154
  elif view_var == "Advanced":
155
  st.dataframe(scoring_percentages.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(game_format, precision=2), height=750, use_container_width = True, hide_index=True)
156
 
157
+ if model_var == 'Player ROO':
158
+ st.header("Player ROO")
159
  with st.expander("Info and Filters"):
160
  col1, col2, col3, col4, col5 = st.columns([3, 3, 3, 3, 3])
161
  with col1:
 
217
  elif view_var == "Advanced":
218
  st.dataframe(st.session_state['player_roo'].style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), height=750, use_container_width = True, hide_index=True)
219
 
220
+ if model_var == 'Optimals':
221
+ st.header("Optimals")
222
  with st.expander("Info and Filters"):
223
  if st.button("Load/Reset Data", key='reset3'):
224
  st.cache_data.clear()