Update app.py
Browse files
app.py
CHANGED
@@ -90,21 +90,31 @@ def init_baselines():
|
|
90 |
'Playoff Odds', 'Division Odds', 'Top 4 Seed Odds', '1 Seed Odds', 'Win 1st Round', 'Win 2nd Round', 'Win Conference', 'Win Title']]
|
91 |
seed_probs = season_model[['Team', 'Conference', 'Division', 'Avg Seed', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15']]
|
92 |
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
def convert_df_to_csv(df):
|
96 |
return df.to_csv().encode('utf-8')
|
97 |
|
98 |
-
game_model, season_model, seed_probs, title_sims, just_win_probs = init_baselines()
|
|
|
99 |
|
100 |
tab1, tab2 = st.tabs(["Game Betting Model", "Season and Futures"])
|
101 |
|
102 |
with tab1:
|
|
|
103 |
col1, col2 = st.columns([1, 9])
|
104 |
with col1:
|
105 |
if st.button("Reset Data", key='reset1'):
|
106 |
st.cache_data.clear()
|
107 |
-
game_model, season_model, seed_probs, title_sims, just_win_probs = init_baselines()
|
|
|
108 |
view_var1 = st.radio("Would you like to view math and stuff or just the win percentages and margins?", ('Just win probs', 'Gimme details'), key='view_var1')
|
109 |
split_var1 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var1')
|
110 |
if split_var1 == 'Specific Teams':
|
@@ -141,11 +151,13 @@ with tab1:
|
|
141 |
)
|
142 |
|
143 |
with tab2:
|
|
|
144 |
col1, col2 = st.columns([1, 9])
|
145 |
with col1:
|
146 |
if st.button("Reset Data", key='reset2'):
|
147 |
st.cache_data.clear()
|
148 |
-
game_model, season_model, seed_probs, title_sims, just_win_probs = init_baselines()
|
|
|
149 |
view_var2 = st.radio("Would you like to view title odds and win projections or seeding probabilities?", ('Win Odds', 'Seed Probabilities'), key='view_var2')
|
150 |
split_var2 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var2')
|
151 |
if split_var2 == 'Specific Teams':
|
|
|
90 |
'Playoff Odds', 'Division Odds', 'Top 4 Seed Odds', '1 Seed Odds', 'Win 1st Round', 'Win 2nd Round', 'Win Conference', 'Win Title']]
|
91 |
seed_probs = season_model[['Team', 'Conference', 'Division', 'Avg Seed', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15']]
|
92 |
|
93 |
+
sh = gcservice_account.open_by_url('https://docs.google.com/spreadsheets/d/1Yq0vGriWK-bS79e-bD6_u9pqrYE6Yrlbb_wEkmH-ot0/edit#gid=1540807349')
|
94 |
+
|
95 |
+
worksheet = sh.worksheet('Arturo Props')
|
96 |
+
raw_display = pd.DataFrame(worksheet.get_all_records())
|
97 |
+
raw_display.replace('', np.nan, inplace=True)
|
98 |
+
timestamp = raw_display['Date'].head(1)[0]
|
99 |
+
|
100 |
+
return game_model, season_model, seed_probs, title_sims, just_win_probs, timestamp
|
101 |
|
102 |
def convert_df_to_csv(df):
|
103 |
return df.to_csv().encode('utf-8')
|
104 |
|
105 |
+
game_model, season_model, seed_probs, title_sims, just_win_probs, timestamp = init_baselines()
|
106 |
+
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
107 |
|
108 |
tab1, tab2 = st.tabs(["Game Betting Model", "Season and Futures"])
|
109 |
|
110 |
with tab1:
|
111 |
+
st.info(t_stamp)
|
112 |
col1, col2 = st.columns([1, 9])
|
113 |
with col1:
|
114 |
if st.button("Reset Data", key='reset1'):
|
115 |
st.cache_data.clear()
|
116 |
+
game_model, season_model, seed_probs, title_sims, just_win_probs, timestamp = init_baselines()
|
117 |
+
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
118 |
view_var1 = st.radio("Would you like to view math and stuff or just the win percentages and margins?", ('Just win probs', 'Gimme details'), key='view_var1')
|
119 |
split_var1 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var1')
|
120 |
if split_var1 == 'Specific Teams':
|
|
|
151 |
)
|
152 |
|
153 |
with tab2:
|
154 |
+
st.info(t_stamp)
|
155 |
col1, col2 = st.columns([1, 9])
|
156 |
with col1:
|
157 |
if st.button("Reset Data", key='reset2'):
|
158 |
st.cache_data.clear()
|
159 |
+
game_model, season_model, seed_probs, title_sims, just_win_probs, timestamp = init_baselines()
|
160 |
+
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
161 |
view_var2 = st.radio("Would you like to view title odds and win projections or seeding probabilities?", ('Win Odds', 'Seed Probabilities'), key='view_var2')
|
162 |
split_var2 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var2')
|
163 |
if split_var2 == 'Specific Teams':
|