James McCool commited on
Commit
ae5a3d1
·
1 Parent(s): a2b1e06

Refactor app.py to reorganize the layout of the "Load/Reset Data" button and the view selection form, enhancing user interface structure and improving data loading functionality. Introduce a form for site selection to streamline user interactions.

Browse files
Files changed (1) hide show
  1. app.py +22 -19
app.py CHANGED
@@ -118,25 +118,28 @@ def convert_df(array):
118
  array = pd.DataFrame(array, columns=column_names)
119
  return array.to_csv().encode('utf-8')
120
 
121
- with st.container():
122
- col1, col2, col3 = st.columns([3, 3, 3])
123
- with col1:
124
- view_var = st.selectbox("Select view", ["Simple", "Advanced"], key='view_var')
125
- with col2:
126
- site_var = st.selectbox("What site do you want to view?", ('Draftkings', 'Fanduel'), key='site_var')
127
- with col3:
128
- container = st.container()
129
- with container:
130
- col = st.columns(3)[2] # Create 3 columns and use middle one
131
- with col:
132
- if st.button("Load/Reset Data", key='reset'):
133
- st.cache_data.clear()
134
- roo_data, sd_roo_data, scoring_percentages = init_baselines()
135
- hold_display = roo_data
136
- dk_lineups = init_DK_lineups('Main')
137
- fd_lineups = init_FD_lineups('Main')
138
- for key in st.session_state.keys():
139
- del st.session_state[key]
 
 
 
140
 
141
  tab1, tab2, tab3 = st.tabs(["Scoring Percentages", "Player ROO", "Optimals"])
142
 
 
118
  array = pd.DataFrame(array, columns=column_names)
119
  return array.to_csv().encode('utf-8')
120
 
121
+ col1, col2 = st.columns([3, 3])
122
+ with col1:
123
+ with st.container():
124
+ col = st.columns(3)[0] # Create 3 columns and use middle one
125
+ with col:
126
+ if st.button("Load/Reset Data", key='reset'):
127
+ st.cache_data.clear()
128
+ roo_data, sd_roo_data, scoring_percentages = init_baselines()
129
+ hold_display = roo_data
130
+ dk_lineups = init_DK_lineups('Main')
131
+ fd_lineups = init_FD_lineups('Main')
132
+ for key in st.session_state.keys():
133
+ del st.session_state[key]
134
+ with col2:
135
+ with st.form("Data Load"):
136
+ col1, col2 = st.columns([3, 3])
137
+ with col1:
138
+ view_var = st.selectbox("Select view", ["Simple", "Advanced"], key='view_var')
139
+ with col2:
140
+ site_var = st.selectbox("What site do you want to view?", ('Draftkings', 'Fanduel'), key='site_var')
141
+ submit_button = st.form_submit_button("Submit")
142
+
143
 
144
  tab1, tab2, tab3 = st.tabs(["Scoring Percentages", "Player ROO", "Optimals"])
145