James McCool commited on
Commit
5369656
·
1 Parent(s): 636dd7e

Refactor app.py to reintroduce tab definitions for Scoring Percentages, Player ROO, and Optimals, ensuring proper organization and functionality within the container. Update caching for data conversion to enhance performance.

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -55,8 +55,6 @@ st.markdown("""
55
  }
56
  </style>""", unsafe_allow_html=True)
57
 
58
- tab1, tab2, tab3 = st.tabs(["Scoring Percentages", "Player ROO", "Optimals"])
59
-
60
  @st.cache_resource(ttl = 60)
61
  def init_baselines():
62
  collection = db["Player_Range_Of_Outcomes"]
@@ -107,6 +105,7 @@ def init_FD_lineups():
107
 
108
  return FD_seed
109
 
 
110
  def convert_df_to_csv(df):
111
  return df.to_csv().encode('utf-8')
112
 
@@ -115,9 +114,6 @@ def convert_df(array):
115
  array = pd.DataFrame(array, columns=column_names)
116
  return array.to_csv().encode('utf-8')
117
 
118
- roo_data, sd_roo_data, scoring_percentages = init_baselines()
119
- hold_display = roo_data
120
-
121
  with st.container():
122
  col1, col2 = st.columns([3, 3])
123
  with col1:
@@ -125,6 +121,11 @@ with st.container():
125
  with col2:
126
  site_var = st.selectbox("What site do you want to view?", ('Draftkings', 'Fanduel'), key='site_var')
127
 
 
 
 
 
 
128
  with tab1:
129
  st.header("Scoring Percentages")
130
  with st.expander("Info and Filters"):
 
55
  }
56
  </style>""", unsafe_allow_html=True)
57
 
 
 
58
  @st.cache_resource(ttl = 60)
59
  def init_baselines():
60
  collection = db["Player_Range_Of_Outcomes"]
 
105
 
106
  return FD_seed
107
 
108
+ @st.cache_data
109
  def convert_df_to_csv(df):
110
  return df.to_csv().encode('utf-8')
111
 
 
114
  array = pd.DataFrame(array, columns=column_names)
115
  return array.to_csv().encode('utf-8')
116
 
 
 
 
117
  with st.container():
118
  col1, col2 = st.columns([3, 3])
119
  with col1:
 
121
  with col2:
122
  site_var = st.selectbox("What site do you want to view?", ('Draftkings', 'Fanduel'), key='site_var')
123
 
124
+ tab1, tab2, tab3 = st.tabs(["Scoring Percentages", "Player ROO", "Optimals"])
125
+
126
+ roo_data, sd_roo_data, scoring_percentages = init_baselines()
127
+ hold_display = roo_data
128
+
129
  with tab1:
130
  st.header("Scoring Percentages")
131
  with st.expander("Info and Filters"):