Spaces:
Running
Running
James McCool
commited on
Commit
·
e60a5ab
1
Parent(s):
17b95a8
Refactor app.py to remove unused API endpoints and update button functionalities for seasonal and weekly rankings, enhancing user interaction with clearer options for ranker selection.
Browse files
app.py
CHANGED
|
@@ -29,21 +29,6 @@ credentials = {
|
|
| 29 |
|
| 30 |
gc = gspread.service_account_from_dict(credentials)
|
| 31 |
|
| 32 |
-
traderater = "https://api.fantasylife.com/api/expert-rankings/v1/ratemytrade/seasonal/update"
|
| 33 |
-
|
| 34 |
-
ros_james_url = "https://api.fantasylife.com/api/expert-rankings/v1/james/ros/update"
|
| 35 |
-
|
| 36 |
-
dwain_url = "https://api.fantasylife.com/api/expert-rankings/v1/dwain/seasonal/update"
|
| 37 |
-
freedman_url = "https://api.fantasylife.com/api/expert-rankings/v1/freedman/seasonal/update"
|
| 38 |
-
agg_url = "https://api.fantasylife.com/api/expert-rankings/v1/aggregate/seasonal/update"
|
| 39 |
-
|
| 40 |
-
weekly_dwain_url = "https://api.fantasylife.com/api/expert-rankings/v1/dwain/weekly/update"
|
| 41 |
-
weekly_freedman_url = "https://api.fantasylife.com/api/expert-rankings/v1/freedman/weekly/update"
|
| 42 |
-
weekly_agg_url = "https://api.fantasylife.com/api/expert-rankings/v1/aggregate/weekly/update"
|
| 43 |
-
|
| 44 |
-
freedman_nfl_game_model = "https://www.fantasylife.com/api/projections/v1/nfl-odds/james/weekly/update"
|
| 45 |
-
thor_ncaaf_game_model = "https://www.fantasylife.com/api/projections/v1/ncaafb-odds/james/weekly/update"
|
| 46 |
-
|
| 47 |
NCAAF_model_url = st.secrets['NCAAF_model_url']
|
| 48 |
pff_url = st.secrets['pff_url']
|
| 49 |
|
|
@@ -51,83 +36,36 @@ headers = {
|
|
| 51 |
'Authorization': 'Bearer 6984da1f-2c81-4140-8206-d018af38533f',
|
| 52 |
}
|
| 53 |
|
| 54 |
-
tab1, tab2, tab3, tab4, tab5 = st.tabs(['
|
| 55 |
|
| 56 |
with tab1:
|
| 57 |
with st.container():
|
| 58 |
-
col1, col2
|
| 59 |
|
| 60 |
with col1:
|
| 61 |
-
st.info("Update
|
| 62 |
-
|
| 63 |
-
|
|
|
|
| 64 |
if response.status_code == 200:
|
| 65 |
st.write("Uploading!")
|
| 66 |
with col2:
|
| 67 |
-
st.info("Update
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
st.write("Uploading!")
|
| 72 |
-
with col3:
|
| 73 |
-
st.info("Update the Aggregate LIVE SITE FantasyLife Season Long Ranks")
|
| 74 |
-
if st.button("Aggregate Projection Update (Live Seasonal)", key='reset3'):
|
| 75 |
-
response = requests.post(agg_url, headers=headers)
|
| 76 |
if response.status_code == 200:
|
| 77 |
st.write("Uploading!")
|
| 78 |
|
| 79 |
|
| 80 |
with tab2:
|
| 81 |
-
|
| 82 |
-
col1, col2, col3 = st.columns([3, 3, 3])
|
| 83 |
-
|
| 84 |
-
with col1:
|
| 85 |
-
st.info("Update Dwain's FantasyLife Weekly Ranks")
|
| 86 |
-
if st.button("Dwain Projection Update (Weekly)", key='reset7'):
|
| 87 |
-
response = requests.post(weekly_dwain_url, headers=headers)
|
| 88 |
-
if response.status_code == 200:
|
| 89 |
-
st.write("Uploading!")
|
| 90 |
-
with col2:
|
| 91 |
-
st.info("Update Freedman's FantasyLife Weekly Ranks")
|
| 92 |
-
if st.button("Freedman Projection Update (Weekly)", key='reset8'):
|
| 93 |
-
response = requests.post(weekly_freedman_url, headers=headers)
|
| 94 |
-
if response.status_code == 200:
|
| 95 |
-
st.write("Uploading!")
|
| 96 |
-
with col3:
|
| 97 |
-
st.info("Update the Aggregate FantasyLife Weekly Ranks")
|
| 98 |
-
if st.button("Aggregate Projection Update (Weekly)", key='reset9'):
|
| 99 |
-
response = requests.post(weekly_agg_url, headers=headers)
|
| 100 |
-
if response.status_code == 200:
|
| 101 |
-
st.write("Uploading!")
|
| 102 |
|
| 103 |
with tab3:
|
| 104 |
-
|
| 105 |
-
col1, col2, col3 = st.columns([3, 3, 3])
|
| 106 |
-
|
| 107 |
-
with col1:
|
| 108 |
-
st.info("Update Freedman NFL Game Model")
|
| 109 |
-
if st.button("Update Freedman NFL Game Model (Weekly)", key='reset10'):
|
| 110 |
-
response = requests.post(freedman_nfl_game_model, headers=headers)
|
| 111 |
-
if response.status_code == 200:
|
| 112 |
-
st.write("Uploading!")
|
| 113 |
-
|
| 114 |
-
with col2:
|
| 115 |
-
st.info("Update Thor NCCAF Game Model")
|
| 116 |
-
if st.button("Update Thor NCCAF Game Model (Weekly)", key='reset11'):
|
| 117 |
-
response = requests.post(thor_ncaaf_game_model, headers=headers)
|
| 118 |
-
if response.status_code == 200:
|
| 119 |
-
st.write("Uploading!")
|
| 120 |
|
| 121 |
with tab4:
|
| 122 |
-
|
| 123 |
-
col1, col2, col3 = st.columns([3, 3, 3])
|
| 124 |
-
|
| 125 |
-
with col1:
|
| 126 |
-
st.info("Update Rest of Season Projections")
|
| 127 |
-
if st.button("Rest of Season Update", key='reset13'):
|
| 128 |
-
response = requests.post(ros_james_url, headers=headers)
|
| 129 |
-
if response.status_code == 200:
|
| 130 |
-
st.write("Uploading!")
|
| 131 |
|
| 132 |
with tab5:
|
| 133 |
with st.container():
|
|
|
|
| 29 |
|
| 30 |
gc = gspread.service_account_from_dict(credentials)
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
NCAAF_model_url = st.secrets['NCAAF_model_url']
|
| 33 |
pff_url = st.secrets['pff_url']
|
| 34 |
|
|
|
|
| 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:
|
| 42 |
with st.container():
|
| 43 |
+
col1, col2 = st.columns(5)
|
| 44 |
|
| 45 |
with col1:
|
| 46 |
+
st.info("Update Seasonal Rankings")
|
| 47 |
+
choose_ranker = st.selectbox("Choose Ranker", ['dwain', 'freedman', 'ian', 'waz', 'charch', 'kendall', 'sam', 'berry'])
|
| 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", ['dwain', 'freedman', 'ian', 'waz', 'charch', 'kendall', 'sam', 'berry'])
|
| 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:
|
| 58 |
st.write("Uploading!")
|
| 59 |
|
| 60 |
|
| 61 |
with tab2:
|
| 62 |
+
st.info("We will add this functionality as soon as we have the endpoints to make it work!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
with tab3:
|
| 65 |
+
st.info("We will add this functionality as soon as we have the endpoints to make it work!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
with tab4:
|
| 68 |
+
st.info("We will add this functionality as soon as we have the endpoints to make it work!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
with tab5:
|
| 71 |
with st.container():
|