Spaces:
Running
Running
James McCool
commited on
Commit
·
1bca9e7
1
Parent(s):
e60a5ab
Add name options for ranker selection in app.py to improve user experience and streamline API calls for seasonal and weekly rankings.
Browse files
app.py
CHANGED
|
@@ -36,6 +36,9 @@ headers = {
|
|
| 36 |
'Authorization': 'Bearer 6984da1f-2c81-4140-8206-d018af38533f',
|
| 37 |
}
|
| 38 |
|
|
|
|
|
|
|
|
|
|
| 39 |
tab1, tab2, tab3, tab4, tab5 = st.tabs(['Rankings Update', 'Projections Update', 'Game Model Update', 'Rest of Season Update', 'NCAAF Script'])
|
| 40 |
|
| 41 |
with tab1:
|
|
@@ -44,14 +47,16 @@ with tab1:
|
|
| 44 |
|
| 45 |
with col1:
|
| 46 |
st.info("Update Seasonal Rankings")
|
| 47 |
-
choose_ranker = st.selectbox("Choose Ranker",
|
|
|
|
| 48 |
if st.button("Update Projections", key='seasonal_rankings'):
|
| 49 |
response = requests.post(f"https://api.fantasylife.com/api/expert-rankings/v1/{choose_ranker}/seasonal/update", headers=headers)
|
| 50 |
if response.status_code == 200:
|
| 51 |
st.write("Uploading!")
|
| 52 |
with col2:
|
| 53 |
st.info("Update Weekly Rankings")
|
| 54 |
-
choose_ranker = st.selectbox("Choose Ranker",
|
|
|
|
| 55 |
if st.button("Update Weekly Rankings", key='weekly_rankings'):
|
| 56 |
response = requests.post(f"https://api.fantasylife.com/api/expert-rankings/v1/{choose_ranker}/weekly/update", headers=headers)
|
| 57 |
if response.status_code == 200:
|
|
|
|
| 36 |
'Authorization': 'Bearer 6984da1f-2c81-4140-8206-d018af38533f',
|
| 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'])
|
| 43 |
|
| 44 |
with tab1:
|
|
|
|
| 47 |
|
| 48 |
with col1:
|
| 49 |
st.info("Update Seasonal Rankings")
|
| 50 |
+
choose_ranker = st.selectbox("Choose Ranker", name_options)
|
| 51 |
+
choose_ranker = api_replace_options[name_options.index(choose_ranker)]
|
| 52 |
if st.button("Update Projections", key='seasonal_rankings'):
|
| 53 |
response = requests.post(f"https://api.fantasylife.com/api/expert-rankings/v1/{choose_ranker}/seasonal/update", headers=headers)
|
| 54 |
if response.status_code == 200:
|
| 55 |
st.write("Uploading!")
|
| 56 |
with col2:
|
| 57 |
st.info("Update Weekly Rankings")
|
| 58 |
+
choose_ranker = st.selectbox("Choose Ranker", name_options)
|
| 59 |
+
choose_ranker = api_replace_options[name_options.index(choose_ranker)]
|
| 60 |
if st.button("Update Weekly Rankings", key='weekly_rankings'):
|
| 61 |
response = requests.post(f"https://api.fantasylife.com/api/expert-rankings/v1/{choose_ranker}/weekly/update", headers=headers)
|
| 62 |
if response.status_code == 200:
|