Spaces:
Running
Running
BraydenMoore
commited on
Commit
•
3324f31
1
Parent(s):
fc2b782
Add results
Browse files
main.py
CHANGED
@@ -9,18 +9,6 @@ pd.set_option('display.expand_frame_repr', False)
|
|
9 |
|
10 |
import os
|
11 |
import json
|
12 |
-
from google.cloud import storage
|
13 |
-
|
14 |
-
# authenticate gcp
|
15 |
-
gcp_sa_key = json.loads(os.environ.get('GCP_SA_KEY'))
|
16 |
-
gcp_sa_key['private_key'] = gcp_sa_key['private_key'].replace('\\n', '\n')
|
17 |
-
client = storage.Client.from_service_account_info(gcp_sa_key)
|
18 |
-
bucket = client.get_bucket('bmllc-marci-data-bucket')
|
19 |
-
|
20 |
-
# download
|
21 |
-
blob = bucket.blob('predictions_this_year.pkl')
|
22 |
-
buffer = blob.download_as_bytes()
|
23 |
-
predictions_this_year = pkl.loads(buffer)
|
24 |
|
25 |
# get week, season
|
26 |
week, season = predict.get_week()
|
@@ -56,18 +44,12 @@ def submit_games():
|
|
56 |
over_under['rowIndex'] = int(row_index)
|
57 |
moneylines.append(moneyline)
|
58 |
over_unders.append(over_under)
|
59 |
-
predictions_this_year[game_id] = {'Moneyline':moneyline,
|
60 |
-
'Over/Under':over_under}
|
61 |
|
62 |
print('MoneyLines')
|
63 |
print(moneylines)
|
64 |
print('OverUnders')
|
65 |
print(over_unders)
|
66 |
|
67 |
-
# update gcp
|
68 |
-
buffer = pkl.dumps(predictions_this_year)
|
69 |
-
blob.upload_from_string(buffer, content_type='application/octet-stream')
|
70 |
-
|
71 |
return jsonify({'moneylines': moneylines,
|
72 |
'over_unders': over_unders})
|
73 |
|
|
|
9 |
|
10 |
import os
|
11 |
import json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# get week, season
|
14 |
week, season = predict.get_week()
|
|
|
44 |
over_under['rowIndex'] = int(row_index)
|
45 |
moneylines.append(moneyline)
|
46 |
over_unders.append(over_under)
|
|
|
|
|
47 |
|
48 |
print('MoneyLines')
|
49 |
print(moneylines)
|
50 |
print('OverUnders')
|
51 |
print(over_unders)
|
52 |
|
|
|
|
|
|
|
|
|
53 |
return jsonify({'moneylines': moneylines,
|
54 |
'over_unders': over_unders})
|
55 |
|