Spaces:
Running
Running
James McCool
commited on
Commit
·
fa3c2fa
1
Parent(s):
1bfac1a
visual update to segmented control
Browse files- src/streamlit_app.py +32 -19
src/streamlit_app.py
CHANGED
|
@@ -26,33 +26,38 @@ sim_all_hold = pd.DataFrame(columns=['Player', 'Team', 'Book', 'Prop Type', 'Pro
|
|
| 26 |
st.markdown("""
|
| 27 |
<style>
|
| 28 |
/* Tab styling */
|
| 29 |
-
.
|
| 30 |
-
gap:
|
| 31 |
padding: 4px;
|
| 32 |
}
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
height: 50px;
|
| 36 |
white-space: pre-wrap;
|
| 37 |
background-color: #DAA520;
|
| 38 |
color: white;
|
| 39 |
-
border-radius:
|
| 40 |
gap: 1px;
|
| 41 |
padding: 10px 20px;
|
| 42 |
font-weight: bold;
|
| 43 |
transition: all 0.3s ease;
|
| 44 |
}
|
| 45 |
-
|
| 46 |
-
|
| 47 |
background-color: #DAA520;
|
| 48 |
border: 3px solid #FFD700;
|
| 49 |
-
|
|
|
|
| 50 |
}
|
| 51 |
-
|
| 52 |
-
.stTabs [data-baseweb="tab"]:hover {
|
| 53 |
background-color: #FFD700;
|
| 54 |
cursor: pointer;
|
| 55 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
</style>""", unsafe_allow_html=True)
|
| 57 |
|
| 58 |
def calculate_poisson(row):
|
|
@@ -179,9 +184,17 @@ def convert_df_to_csv(df):
|
|
| 179 |
game_model, raw_baselines, player_stats, prop_frame, pick_frame, market_props, timestamp = init_baselines()
|
| 180 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
| 181 |
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
with st.expander("Info and Filters"):
|
| 186 |
st.info(t_stamp)
|
| 187 |
if st.button("Reset Data", key='reset1'):
|
|
@@ -207,7 +220,7 @@ with tab1:
|
|
| 207 |
key='team_export',
|
| 208 |
)
|
| 209 |
|
| 210 |
-
|
| 211 |
with st.expander("Info and Filters"):
|
| 212 |
st.info(t_stamp)
|
| 213 |
if st.button("Reset Data", key='reset2'):
|
|
@@ -243,7 +256,7 @@ with tab2:
|
|
| 243 |
mime='text/csv',
|
| 244 |
)
|
| 245 |
|
| 246 |
-
|
| 247 |
with st.expander("Info and Filters"):
|
| 248 |
st.info(t_stamp)
|
| 249 |
if st.button("Reset Data", key='reset3'):
|
|
@@ -266,7 +279,7 @@ with tab3:
|
|
| 266 |
mime='text/csv',
|
| 267 |
)
|
| 268 |
|
| 269 |
-
|
| 270 |
with st.expander("Info and Filters"):
|
| 271 |
st.info(t_stamp)
|
| 272 |
if st.button("Reset Data", key='reset4'):
|
|
@@ -296,7 +309,7 @@ with tab4:
|
|
| 296 |
mime='text/csv',
|
| 297 |
)
|
| 298 |
|
| 299 |
-
|
| 300 |
st.info(t_stamp)
|
| 301 |
if st.button("Reset Data", key='reset5'):
|
| 302 |
st.cache_data.clear()
|
|
@@ -443,7 +456,7 @@ with tab5:
|
|
| 443 |
plot_hold_container = st.empty()
|
| 444 |
st.plotly_chart(fig, use_container_width=True)
|
| 445 |
|
| 446 |
-
|
| 447 |
st.info(t_stamp)
|
| 448 |
st.info('The Over and Under percentages are a compositve percentage based on simulations, historical performance, and implied probabilities, and may be different than you would expect based purely on the median projection. Likewise, the Edge of a bet is not the only indicator of if you should make the bet or not as the suggestion is using a base acceptable threshold to determine how much edge you should have for each stat category.')
|
| 449 |
if st.button("Reset Data/Load Data", key='reset6'):
|
|
|
|
| 26 |
st.markdown("""
|
| 27 |
<style>
|
| 28 |
/* Tab styling */
|
| 29 |
+
.stElementContainer [data-baseweb="button-group"] {
|
| 30 |
+
gap: 2.000rem;
|
| 31 |
padding: 4px;
|
| 32 |
}
|
| 33 |
+
.stElementContainer [kind="segmented_control"] {
|
| 34 |
+
height: 2.000rem;
|
|
|
|
| 35 |
white-space: pre-wrap;
|
| 36 |
background-color: #DAA520;
|
| 37 |
color: white;
|
| 38 |
+
border-radius: 20px;
|
| 39 |
gap: 1px;
|
| 40 |
padding: 10px 20px;
|
| 41 |
font-weight: bold;
|
| 42 |
transition: all 0.3s ease;
|
| 43 |
}
|
| 44 |
+
.stElementContainer [kind="segmented_controlActive"] {
|
| 45 |
+
height: 3.000rem;
|
| 46 |
background-color: #DAA520;
|
| 47 |
border: 3px solid #FFD700;
|
| 48 |
+
border-radius: 10px;
|
| 49 |
+
color: black;
|
| 50 |
}
|
| 51 |
+
.stElementContainer [kind="segmented_control"]:hover {
|
|
|
|
| 52 |
background-color: #FFD700;
|
| 53 |
cursor: pointer;
|
| 54 |
}
|
| 55 |
+
|
| 56 |
+
div[data-baseweb="select"] > div {
|
| 57 |
+
background-color: #DAA520;
|
| 58 |
+
color: white;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
</style>""", unsafe_allow_html=True)
|
| 62 |
|
| 63 |
def calculate_poisson(row):
|
|
|
|
| 184 |
game_model, raw_baselines, player_stats, prop_frame, pick_frame, market_props, timestamp = init_baselines()
|
| 185 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
| 186 |
|
| 187 |
+
selected_tab = st.segmented_control(
|
| 188 |
+
"Select Tab",
|
| 189 |
+
options=["Game Betting Model", 'Prop Market', "Player Projections", "Prop Trend Table", "Player Prop Simulations", "Stat Specific Simulations"],
|
| 190 |
+
selection_mode='single',
|
| 191 |
+
default='Game Betting Model',
|
| 192 |
+
width='stretch',
|
| 193 |
+
label_visibility='collapsed',
|
| 194 |
+
key='tab_selector'
|
| 195 |
+
)
|
| 196 |
+
|
| 197 |
+
if selected_tab == 'Game Betting Model':
|
| 198 |
with st.expander("Info and Filters"):
|
| 199 |
st.info(t_stamp)
|
| 200 |
if st.button("Reset Data", key='reset1'):
|
|
|
|
| 220 |
key='team_export',
|
| 221 |
)
|
| 222 |
|
| 223 |
+
if selected_tab == 'Prop Market':
|
| 224 |
with st.expander("Info and Filters"):
|
| 225 |
st.info(t_stamp)
|
| 226 |
if st.button("Reset Data", key='reset2'):
|
|
|
|
| 256 |
mime='text/csv',
|
| 257 |
)
|
| 258 |
|
| 259 |
+
if selected_tab == 'Player Projections':
|
| 260 |
with st.expander("Info and Filters"):
|
| 261 |
st.info(t_stamp)
|
| 262 |
if st.button("Reset Data", key='reset3'):
|
|
|
|
| 279 |
mime='text/csv',
|
| 280 |
)
|
| 281 |
|
| 282 |
+
if selected_tab == 'Prop Trend Table':
|
| 283 |
with st.expander("Info and Filters"):
|
| 284 |
st.info(t_stamp)
|
| 285 |
if st.button("Reset Data", key='reset4'):
|
|
|
|
| 309 |
mime='text/csv',
|
| 310 |
)
|
| 311 |
|
| 312 |
+
if selected_tab == 'Player Prop Simulations':
|
| 313 |
st.info(t_stamp)
|
| 314 |
if st.button("Reset Data", key='reset5'):
|
| 315 |
st.cache_data.clear()
|
|
|
|
| 456 |
plot_hold_container = st.empty()
|
| 457 |
st.plotly_chart(fig, use_container_width=True)
|
| 458 |
|
| 459 |
+
if selected_tab == 'Stat Specific Simulations':
|
| 460 |
st.info(t_stamp)
|
| 461 |
st.info('The Over and Under percentages are a compositve percentage based on simulations, historical performance, and implied probabilities, and may be different than you would expect based purely on the median projection. Likewise, the Edge of a bet is not the only indicator of if you should make the bet or not as the suggestion is using a base acceptable threshold to determine how much edge you should have for each stat category.')
|
| 462 |
if st.button("Reset Data/Load Data", key='reset6'):
|