Spaces:
Running
Running
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
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 |
-
|
122 |
-
|
123 |
-
with
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
st.
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
|
|
|
|
|
|
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 |
|