Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,14 +23,13 @@ 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:Xr1q5wZdXPbxdUmJ@testcluster.lgwtp5i.mongodb.net/?retryWrites=true&w=majority&appName=TestCluster"
|
| 26 |
-
|
| 27 |
-
db = client["testing_db"]
|
| 28 |
|
| 29 |
MLB_Data = 'https://docs.google.com/spreadsheets/d/1f42Ergav8K1VsOLOK9MUn7DM_MLMvv4GR2Fy7EfnZTc/edit#gid=340831852'
|
| 30 |
|
| 31 |
gc_con = gspread.service_account_from_dict(credentials, scope)
|
| 32 |
|
| 33 |
-
return gc_con,
|
| 34 |
|
| 35 |
gcservice_account, db, MLB_Data = init_conn()
|
| 36 |
|
|
@@ -40,15 +39,18 @@ dk_columns = ['SP1', 'SP2', 'C', '1B', '2B', '3B', 'SS', 'OF1', 'OF2', 'OF3', 's
|
|
| 40 |
fd_columns = ['P', 'C_1B', '2B', '3B', 'SS', 'OF1', 'OF2', 'OF3', 'UTIL', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count']
|
| 41 |
|
| 42 |
@st.cache_data(ttl = 599)
|
| 43 |
-
def init_seed_frames(
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
| 45 |
cursor = collection.find()
|
| 46 |
|
| 47 |
raw_display = pd.DataFrame(list(cursor))
|
| 48 |
raw_display = raw_display[['SP1', 'SP2', 'C', '1B', '2B', '3B', 'SS', 'OF1', 'OF2', 'OF3', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count']]
|
| 49 |
DK_seed = raw_display.to_numpy()
|
| 50 |
|
| 51 |
-
collection =
|
| 52 |
cursor = collection.find()
|
| 53 |
|
| 54 |
raw_display = pd.DataFrame(list(cursor))
|
|
|
|
| 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:Xr1q5wZdXPbxdUmJ@testcluster.lgwtp5i.mongodb.net/?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, db, MLB_Data = init_conn()
|
| 35 |
|
|
|
|
| 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(uri):
|
| 43 |
+
client = pymongo.MongoClient(uri, retryWrites=True, serverSelectionTimeoutMS=100000)
|
| 44 |
+
db = client["testing_db"]
|
| 45 |
+
|
| 46 |
+
collection = db["DK_MLB_seed_frame"]
|
| 47 |
cursor = collection.find()
|
| 48 |
|
| 49 |
raw_display = pd.DataFrame(list(cursor))
|
| 50 |
raw_display = raw_display[['SP1', 'SP2', 'C', '1B', '2B', '3B', 'SS', 'OF1', 'OF2', 'OF3', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count']]
|
| 51 |
DK_seed = raw_display.to_numpy()
|
| 52 |
|
| 53 |
+
collection = db["FD_MLB_seed_frame"]
|
| 54 |
cursor = collection.find()
|
| 55 |
|
| 56 |
raw_display = pd.DataFrame(list(cursor))
|