Spaces:
Running
Running
James McCool
commited on
Commit
·
d17c4ea
1
Parent(s):
f1c48f4
Add options for seasonal and weekly projections in app.py, enhancing functionality for user interactions and API updates in the projections update section.
Browse files
app.py
CHANGED
|
@@ -37,6 +37,8 @@ headers = {
|
|
| 37 |
}
|
| 38 |
|
| 39 |
name_options = ['Dwain', 'Freedman', 'Ian', 'Waz', 'Charch', 'Kendall', 'Sam', 'Matthew Berry']
|
|
|
|
|
|
|
| 40 |
api_replace_options = ['dwain', 'freedman', 'ian', 'waz', 'charch', 'kendall', 'sam', 'berry', 'james', 'james_ncaaf']
|
| 41 |
|
| 42 |
tab1, tab2, tab3, tab4, tab5 = st.tabs(['Rankings Update', 'Projections Update', 'Game Model Update', 'Rest of Season Update', 'NCAAF Script'])
|
|
@@ -47,42 +49,67 @@ with tab1:
|
|
| 47 |
|
| 48 |
with col1:
|
| 49 |
st.info("Update Seasonal Rankings")
|
| 50 |
-
|
| 51 |
-
|
| 52 |
if st.button("Update Seasonal Rankings", key='seasonal_rankings'):
|
| 53 |
-
response = requests.post(f"https://api.fantasylife.com/api/expert-rankings/v1/{
|
| 54 |
if response.status_code == 200:
|
| 55 |
st.write("Uploading!")
|
|
|
|
|
|
|
| 56 |
with col2:
|
| 57 |
st.info("Update Weekly Rankings")
|
| 58 |
-
|
| 59 |
-
|
| 60 |
if st.button("Update Weekly Rankings", key='weekly_rankings'):
|
| 61 |
-
response = requests.post(f"https://api.fantasylife.com/api/expert-rankings/v1/{
|
| 62 |
if response.status_code == 200:
|
| 63 |
st.write("Uploading!")
|
|
|
|
| 64 |
|
| 65 |
with col3:
|
| 66 |
st.info("Update Seasonal Guillotine Rankings")
|
| 67 |
-
|
| 68 |
-
|
| 69 |
if st.button("Update Seasonal Guillotine Rankings", key='seasonal_guillotine_rankings'):
|
| 70 |
-
response = requests.post(f"https://api.fantasylife.com/api/guillotine-rankings/v1/{
|
| 71 |
if response.status_code == 200:
|
| 72 |
st.write("Uploading!")
|
|
|
|
| 73 |
|
| 74 |
with col4:
|
| 75 |
st.info("Update Weekly Guillotine Rankings")
|
| 76 |
-
|
| 77 |
-
|
| 78 |
if st.button("Update Weekly Guillotine Rankings", key='weekly_guillotine_rankings'):
|
| 79 |
-
response = requests.post(f"https://api.fantasylife.com/api/guillotine-rankings/v1/{
|
| 80 |
if response.status_code == 200:
|
| 81 |
st.write("Uploading!")
|
|
|
|
| 82 |
|
| 83 |
|
| 84 |
with tab2:
|
| 85 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
with tab3:
|
| 88 |
st.info("We will add this functionality as soon as we have the endpoints to make it work!")
|
|
|
|
| 37 |
}
|
| 38 |
|
| 39 |
name_options = ['Dwain', 'Freedman', 'Ian', 'Waz', 'Charch', 'Kendall', 'Sam', 'Matthew Berry']
|
| 40 |
+
proj_source_options = ['Dwain', 'Aggregate', 'Freedman', 'Kickers', 'Defenses']
|
| 41 |
+
proj_replace_options = ['dwain', 'aggregate', 'freedman', 'kickers', 'defenses']
|
| 42 |
api_replace_options = ['dwain', 'freedman', 'ian', 'waz', 'charch', 'kendall', 'sam', 'berry', 'james', 'james_ncaaf']
|
| 43 |
|
| 44 |
tab1, tab2, tab3, tab4, tab5 = st.tabs(['Rankings Update', 'Projections Update', 'Game Model Update', 'Rest of Season Update', 'NCAAF Script'])
|
|
|
|
| 49 |
|
| 50 |
with col1:
|
| 51 |
st.info("Update Seasonal Rankings")
|
| 52 |
+
choose_seasonal_ranker = st.selectbox("Choose Ranker", name_options, key='seasonal_ranker')
|
| 53 |
+
choose_seasonal_ranker = api_replace_options[name_options.index(choose_seasonal_ranker)]
|
| 54 |
if st.button("Update Seasonal Rankings", key='seasonal_rankings'):
|
| 55 |
+
response = requests.post(f"https://api.fantasylife.com/api/expert-rankings/v1/{choose_seasonal_ranker}/seasonal/update", headers=headers)
|
| 56 |
if response.status_code == 200:
|
| 57 |
st.write("Uploading!")
|
| 58 |
+
st.write(response.json())
|
| 59 |
+
|
| 60 |
with col2:
|
| 61 |
st.info("Update Weekly Rankings")
|
| 62 |
+
choose_weekly_ranker = st.selectbox("Choose Ranker", name_options, key='weekly_ranker')
|
| 63 |
+
choose_weekly_ranker = api_replace_options[name_options.index(choose_weekly_ranker)]
|
| 64 |
if st.button("Update Weekly Rankings", key='weekly_rankings'):
|
| 65 |
+
response = requests.post(f"https://api.fantasylife.com/api/expert-rankings/v1/{choose_weekly_ranker}/weekly/update", headers=headers)
|
| 66 |
if response.status_code == 200:
|
| 67 |
st.write("Uploading!")
|
| 68 |
+
st.write(response.json())
|
| 69 |
|
| 70 |
with col3:
|
| 71 |
st.info("Update Seasonal Guillotine Rankings")
|
| 72 |
+
choose_seasonal_guillotine_ranker = st.selectbox("Choose Ranker", name_options, key='seasonal_guillotine_ranker')
|
| 73 |
+
choose_seasonal_guillotine_ranker = api_replace_options[name_options.index(choose_seasonal_guillotine_ranker)]
|
| 74 |
if st.button("Update Seasonal Guillotine Rankings", key='seasonal_guillotine_rankings'):
|
| 75 |
+
response = requests.post(f"https://api.fantasylife.com/api/guillotine-rankings/v1/{choose_seasonal_guillotine_ranker}/seasonal/update", headers=headers)
|
| 76 |
if response.status_code == 200:
|
| 77 |
st.write("Uploading!")
|
| 78 |
+
st.write(response.json())
|
| 79 |
|
| 80 |
with col4:
|
| 81 |
st.info("Update Weekly Guillotine Rankings")
|
| 82 |
+
choose_weekly_guillotine_ranker = st.selectbox("Choose Ranker", name_options, key='weekly_guillotine_ranker')
|
| 83 |
+
choose_weekly_guillotine_ranker = api_replace_options[name_options.index(choose_weekly_guillotine_ranker)]
|
| 84 |
if st.button("Update Weekly Guillotine Rankings", key='weekly_guillotine_rankings'):
|
| 85 |
+
response = requests.post(f"https://api.fantasylife.com/api/guillotine-rankings/v1/{choose_weekly_guillotine_ranker}/weekly/update", headers=headers)
|
| 86 |
if response.status_code == 200:
|
| 87 |
st.write("Uploading!")
|
| 88 |
+
st.write(response.json())
|
| 89 |
|
| 90 |
|
| 91 |
with tab2:
|
| 92 |
+
with st.container():
|
| 93 |
+
col1, col2, col3, col4 = st.columns([3, 3, 3, 3])
|
| 94 |
+
|
| 95 |
+
with col1:
|
| 96 |
+
st.info("Update Seasonal Projections")
|
| 97 |
+
choose_seasonal_type = st.selectbox("Choose Type", proj_source_options, key='seasonal_type')
|
| 98 |
+
choose_seasonal_type = proj_replace_options[proj_source_options.index(choose_seasonal_type)]
|
| 99 |
+
if st.button("Update Seasonal Projections", key='seasonal_projections'):
|
| 100 |
+
response = requests.post(f"https://api.fantasylife.com/api/projections/v1/{choose_seasonal_type}/seasonal/update", headers=headers)
|
| 101 |
+
if response.status_code == 200:
|
| 102 |
+
st.write("Uploading!")
|
| 103 |
+
st.write(response.json())
|
| 104 |
+
with col2:
|
| 105 |
+
st.info("Update Weekly Projections")
|
| 106 |
+
choose_weekly_type = st.selectbox("Choose Type", proj_source_options, key='weekly_type')
|
| 107 |
+
choose_weekly_type = proj_replace_options[proj_source_options.index(choose_weekly_type)]
|
| 108 |
+
if st.button("Update Weekly Projections", key='weekly_projections'):
|
| 109 |
+
response = requests.post(f"https://api.fantasylife.com/api/projections/v1/{choose_weekly_type}/weekly/update", headers=headers)
|
| 110 |
+
if response.status_code == 200:
|
| 111 |
+
st.write("Uploading!")
|
| 112 |
+
st.write(response.json())
|
| 113 |
|
| 114 |
with tab3:
|
| 115 |
st.info("We will add this functionality as soon as we have the endpoints to make it work!")
|