Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -23,15 +23,14 @@ def init_conn():
|
|
23 |
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/gspread-connection%40model-sheets-connect.iam.gserviceaccount.com"
|
24 |
}
|
25 |
uri = "mongodb+srv://multichem:[email protected]/?retryWrites=true&w=majority&appName=TestCluster"
|
26 |
-
|
27 |
-
|
28 |
MLB_Data = 'https://docs.google.com/spreadsheets/d/1f42Ergav8K1VsOLOK9MUn7DM_MLMvv4GR2Fy7EfnZTc/edit#gid=340831852'
|
29 |
|
30 |
gc_con = gspread.service_account_from_dict(credentials, scope)
|
31 |
|
32 |
return gc_con, uri, MLB_Data
|
33 |
|
34 |
-
gcservice_account,
|
35 |
|
36 |
percentages_format = {'Exposure': '{:.2%}'}
|
37 |
freq_format = {'Exposure': '{:.2%}', 'Proj Own': '{:.2%}', 'Edge': '{:.2%}'}
|
@@ -39,7 +38,7 @@ dk_columns = ['SP1', 'SP2', 'C', '1B', '2B', '3B', 'SS', 'OF1', 'OF2', 'OF3', 's
|
|
39 |
fd_columns = ['P', 'C_1B', '2B', '3B', 'SS', 'OF1', 'OF2', 'OF3', 'UTIL', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count']
|
40 |
|
41 |
@st.cache_data(ttl = 599)
|
42 |
-
def init_seed_frames(
|
43 |
client = pymongo.MongoClient(uri, retryWrites=True, serverSelectionTimeoutMS=100000)
|
44 |
db = client["testing_db"]
|
45 |
|
@@ -57,6 +56,8 @@ def init_seed_frames(uri):
|
|
57 |
raw_display = raw_display[['P', 'C_1B', '2B', '3B', 'SS', 'OF1', 'OF2', 'OF3', 'UTIL', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count']]
|
58 |
FD_seed = raw_display.to_numpy()
|
59 |
|
|
|
|
|
60 |
return DK_Seed, FD_Seed
|
61 |
|
62 |
@st.cache_data(ttl = 599)
|
|
|
23 |
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/gspread-connection%40model-sheets-connect.iam.gserviceaccount.com"
|
24 |
}
|
25 |
uri = "mongodb+srv://multichem:[email protected]/?retryWrites=true&w=majority&appName=TestCluster"
|
26 |
+
|
|
|
27 |
MLB_Data = 'https://docs.google.com/spreadsheets/d/1f42Ergav8K1VsOLOK9MUn7DM_MLMvv4GR2Fy7EfnZTc/edit#gid=340831852'
|
28 |
|
29 |
gc_con = gspread.service_account_from_dict(credentials, scope)
|
30 |
|
31 |
return gc_con, uri, MLB_Data
|
32 |
|
33 |
+
gcservice_account, uri, MLB_Data = init_conn()
|
34 |
|
35 |
percentages_format = {'Exposure': '{:.2%}'}
|
36 |
freq_format = {'Exposure': '{:.2%}', 'Proj Own': '{:.2%}', 'Edge': '{:.2%}'}
|
|
|
38 |
fd_columns = ['P', 'C_1B', '2B', '3B', 'SS', 'OF1', 'OF2', 'OF3', 'UTIL', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count']
|
39 |
|
40 |
@st.cache_data(ttl = 599)
|
41 |
+
def init_seed_frames():
|
42 |
client = pymongo.MongoClient(uri, retryWrites=True, serverSelectionTimeoutMS=100000)
|
43 |
db = client["testing_db"]
|
44 |
|
|
|
56 |
raw_display = raw_display[['P', 'C_1B', '2B', '3B', 'SS', 'OF1', 'OF2', 'OF3', 'UTIL', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count']]
|
57 |
FD_seed = raw_display.to_numpy()
|
58 |
|
59 |
+
client.close()
|
60 |
+
|
61 |
return DK_Seed, FD_Seed
|
62 |
|
63 |
@st.cache_data(ttl = 599)
|