Spaces:
Running
Running
James McCool
commited on
Commit
·
b35d369
1
Parent(s):
0d70ecc
Update app.py to include 'Aggregate' in project and rest of season options. Removed redundant API calls for aggregate updates, streamlining the update process and enhancing user experience.
Browse files
app.py
CHANGED
|
@@ -46,10 +46,10 @@ headers = {
|
|
| 46 |
|
| 47 |
name_options = ['Dwain', 'Freedman', 'Ian', 'Waz', 'Charch', 'Kendall', 'Sam', 'Laghezza', 'Ronis', 'Matthew Berry']
|
| 48 |
api_replace_options = ['dwain', 'freedman', 'ian', 'waz', 'charch', 'kendall', 'sam', 'laghezza', 'ronis', 'berry']
|
| 49 |
-
proj_source_options = ['Dwain', 'Freedman', 'Kickers', 'Defenses']
|
| 50 |
-
proj_replace_options = ['dwain', 'freedman', 'kickers', 'defenses']
|
| 51 |
-
ros_source_options = ['Laghezza', 'Ronis', 'Dwain', 'Freedman']
|
| 52 |
-
ros_replace_options = ['laghezza', 'ronis', 'dwain', 'freedman']
|
| 53 |
data_update_options = ['Betting Model', 'DFS', 'DVP', 'Strength of Sched', 'Air Yards', 'FAAB']
|
| 54 |
|
| 55 |
|
|
@@ -303,15 +303,6 @@ with tab2:
|
|
| 303 |
st.cache_data.clear()
|
| 304 |
for key in st.session_state.keys():
|
| 305 |
del st.session_state[key]
|
| 306 |
-
response = requests.post(f"https://api.fantasylife.com/api/projections/v1/aggregate/seasonal/update", headers=headers)
|
| 307 |
-
if response.status_code == 200:
|
| 308 |
-
st.write("Uploading Aggregate as well.")
|
| 309 |
-
else:
|
| 310 |
-
st.write("Error uploading seasonal aggregate projections")
|
| 311 |
-
st.write(response.json())
|
| 312 |
-
st.cache_data.clear()
|
| 313 |
-
for key in st.session_state.keys():
|
| 314 |
-
del st.session_state[key]
|
| 315 |
with reg_weekly_proj_col:
|
| 316 |
st.info("Update Weekly Projections")
|
| 317 |
choose_weekly_type = st.selectbox("Choose Type", proj_source_options, key='weekly_type')
|
|
@@ -330,15 +321,6 @@ with tab2:
|
|
| 330 |
st.cache_data.clear()
|
| 331 |
for key in st.session_state.keys():
|
| 332 |
del st.session_state[key]
|
| 333 |
-
response = requests.post(f"https://api.fantasylife.com/api/projections/v1/aggregate/weekly/update", headers=headers)
|
| 334 |
-
if response.status_code == 200:
|
| 335 |
-
st.write("Uploading Aggregate as well.")
|
| 336 |
-
else:
|
| 337 |
-
st.write("Error uploading weekly aggregate projections")
|
| 338 |
-
st.write(response.json())
|
| 339 |
-
st.cache_data.clear()
|
| 340 |
-
for key in st.session_state.keys():
|
| 341 |
-
del st.session_state[key]
|
| 342 |
|
| 343 |
with reg_ros_proj_col:
|
| 344 |
st.info("Update Rest of Season Projections")
|
|
@@ -358,15 +340,6 @@ with tab2:
|
|
| 358 |
st.cache_data.clear()
|
| 359 |
for key in st.session_state.keys():
|
| 360 |
del st.session_state[key]
|
| 361 |
-
response = requests.post(f"https://api.fantasylife.com/api/projections/v1/aggregate/restofseason/update", headers=headers)
|
| 362 |
-
if response.status_code == 200:
|
| 363 |
-
st.write("Uploading Aggregate as well.")
|
| 364 |
-
else:
|
| 365 |
-
st.write("Error uploading rest of season aggregate projections")
|
| 366 |
-
st.write(response.json())
|
| 367 |
-
st.cache_data.clear()
|
| 368 |
-
for key in st.session_state.keys():
|
| 369 |
-
del st.session_state[key]
|
| 370 |
|
| 371 |
with st.container():
|
| 372 |
st.header("Update Guillotine Projections")
|
|
@@ -390,15 +363,6 @@ with tab2:
|
|
| 390 |
st.cache_data.clear()
|
| 391 |
for key in st.session_state.keys():
|
| 392 |
del st.session_state[key]
|
| 393 |
-
response = requests.post(f"https://api.fantasylife.com/api/projections/v1/aggregate/seasonal/update", headers=headers)
|
| 394 |
-
if response.status_code == 200:
|
| 395 |
-
st.write("Uploading Aggregate as well.")
|
| 396 |
-
else:
|
| 397 |
-
st.write("Error uploading seasonal guillotine aggregate projections")
|
| 398 |
-
st.write(response.json())
|
| 399 |
-
st.cache_data.clear()
|
| 400 |
-
for key in st.session_state.keys():
|
| 401 |
-
del st.session_state[key]
|
| 402 |
with guillotine_weekly_proj_col:
|
| 403 |
st.info("Update Weekly Guillotine Projections")
|
| 404 |
choose_guillotine_weekly_type = st.selectbox("Choose Type", proj_source_options, key='weekly_guillotine_type')
|
|
@@ -417,15 +381,6 @@ with tab2:
|
|
| 417 |
st.cache_data.clear()
|
| 418 |
for key in st.session_state.keys():
|
| 419 |
del st.session_state[key]
|
| 420 |
-
response = requests.post(f"https://api.fantasylife.com/api/projections/v1/aggregate/weekly/update", headers=headers)
|
| 421 |
-
if response.status_code == 200:
|
| 422 |
-
st.write("Uploading Aggregate as well.")
|
| 423 |
-
else:
|
| 424 |
-
st.write("Error uploading weekly guillotine aggregate projections")
|
| 425 |
-
st.write(response.json())
|
| 426 |
-
st.cache_data.clear()
|
| 427 |
-
for key in st.session_state.keys():
|
| 428 |
-
del st.session_state[key]
|
| 429 |
|
| 430 |
with guillotine_ros_proj_col:
|
| 431 |
st.info("Update Rest of Season Guillotine Projections")
|
|
@@ -445,15 +400,6 @@ with tab2:
|
|
| 445 |
st.cache_data.clear()
|
| 446 |
for key in st.session_state.keys():
|
| 447 |
del st.session_state[key]
|
| 448 |
-
response = requests.post(f"https://api.fantasylife.com/api/projections/v1/aggregate/restofseason/update", headers=headers)
|
| 449 |
-
if response.status_code == 200:
|
| 450 |
-
st.write("Uploading Aggregate as well.")
|
| 451 |
-
else:
|
| 452 |
-
st.write("Error uploading rest of season guillotine aggregate projections")
|
| 453 |
-
st.write(response.json())
|
| 454 |
-
st.cache_data.clear()
|
| 455 |
-
for key in st.session_state.keys():
|
| 456 |
-
del st.session_state[key]
|
| 457 |
|
| 458 |
with tab3:
|
| 459 |
with st.container():
|
|
|
|
| 46 |
|
| 47 |
name_options = ['Dwain', 'Freedman', 'Ian', 'Waz', 'Charch', 'Kendall', 'Sam', 'Laghezza', 'Ronis', 'Matthew Berry']
|
| 48 |
api_replace_options = ['dwain', 'freedman', 'ian', 'waz', 'charch', 'kendall', 'sam', 'laghezza', 'ronis', 'berry']
|
| 49 |
+
proj_source_options = ['Dwain', 'Freedman', 'Aggregate', 'Kickers', 'Defenses']
|
| 50 |
+
proj_replace_options = ['dwain', 'freedman', 'aggregate', 'kickers', 'defenses']
|
| 51 |
+
ros_source_options = ['Laghezza', 'Ronis', 'Dwain', 'Freedman', 'Aggregate']
|
| 52 |
+
ros_replace_options = ['laghezza', 'ronis', 'dwain', 'freedman', 'aggregate']
|
| 53 |
data_update_options = ['Betting Model', 'DFS', 'DVP', 'Strength of Sched', 'Air Yards', 'FAAB']
|
| 54 |
|
| 55 |
|
|
|
|
| 303 |
st.cache_data.clear()
|
| 304 |
for key in st.session_state.keys():
|
| 305 |
del st.session_state[key]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 306 |
with reg_weekly_proj_col:
|
| 307 |
st.info("Update Weekly Projections")
|
| 308 |
choose_weekly_type = st.selectbox("Choose Type", proj_source_options, key='weekly_type')
|
|
|
|
| 321 |
st.cache_data.clear()
|
| 322 |
for key in st.session_state.keys():
|
| 323 |
del st.session_state[key]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
|
| 325 |
with reg_ros_proj_col:
|
| 326 |
st.info("Update Rest of Season Projections")
|
|
|
|
| 340 |
st.cache_data.clear()
|
| 341 |
for key in st.session_state.keys():
|
| 342 |
del st.session_state[key]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 343 |
|
| 344 |
with st.container():
|
| 345 |
st.header("Update Guillotine Projections")
|
|
|
|
| 363 |
st.cache_data.clear()
|
| 364 |
for key in st.session_state.keys():
|
| 365 |
del st.session_state[key]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 366 |
with guillotine_weekly_proj_col:
|
| 367 |
st.info("Update Weekly Guillotine Projections")
|
| 368 |
choose_guillotine_weekly_type = st.selectbox("Choose Type", proj_source_options, key='weekly_guillotine_type')
|
|
|
|
| 381 |
st.cache_data.clear()
|
| 382 |
for key in st.session_state.keys():
|
| 383 |
del st.session_state[key]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 384 |
|
| 385 |
with guillotine_ros_proj_col:
|
| 386 |
st.info("Update Rest of Season Guillotine Projections")
|
|
|
|
| 400 |
st.cache_data.clear()
|
| 401 |
for key in st.session_state.keys():
|
| 402 |
del st.session_state[key]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 403 |
|
| 404 |
with tab3:
|
| 405 |
with st.container():
|