Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
|
@@ -73,6 +73,10 @@ async def on_ready():
|
|
| 73 |
data['discord_user_id'] = data['discord_user_id'].astype(str)
|
| 74 |
global_df = data
|
| 75 |
print(f"csv successfully retrieved: \n {global_df}")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
worksheet2_df = data2
|
| 77 |
|
| 78 |
# updates both leaderboards
|
|
@@ -104,6 +108,8 @@ def update_google_sheet():
|
|
| 104 |
|
| 105 |
name2 = "hf_discord_verified_users_test"
|
| 106 |
# could just do this / format
|
|
|
|
|
|
|
| 107 |
set_with_dataframe(worksheet2, worksheet2_df)
|
| 108 |
# very important, otherwise gspread will force format IDs in scientific notation by default (making them unusable)
|
| 109 |
worksheet2.format(f"E1:E{len(worksheet2_df.index)+1}", {
|
|
@@ -111,6 +117,11 @@ def update_google_sheet():
|
|
| 111 |
"type": 'TEXT',
|
| 112 |
},
|
| 113 |
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
| 116 |
print(f"Google sheet {name2} successfully updated at {timestamp}!")
|
|
@@ -121,7 +132,7 @@ def update_google_sheet():
|
|
| 121 |
|
| 122 |
executor = ThreadPoolExecutor(max_workers=1)
|
| 123 |
scheduler = BackgroundScheduler(executors={'default': executor})
|
| 124 |
-
scheduler.add_job(update_google_sheet, trigger='interval', minutes=
|
| 125 |
scheduler.start()
|
| 126 |
|
| 127 |
|
|
|
|
| 73 |
data['discord_user_id'] = data['discord_user_id'].astype(str)
|
| 74 |
global_df = data
|
| 75 |
print(f"csv successfully retrieved: \n {global_df}")
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
data2['discord_user_id'] = data2['discord_user_id'].astype(str)
|
| 79 |
+
data2['id_recover_test'] = data2['id_recover_test'].astype(str)
|
| 80 |
worksheet2_df = data2
|
| 81 |
|
| 82 |
# updates both leaderboards
|
|
|
|
| 108 |
|
| 109 |
name2 = "hf_discord_verified_users_test"
|
| 110 |
# could just do this / format
|
| 111 |
+
data2['discord_user_id'] = data2['discord_user_id'].astype(str)
|
| 112 |
+
data2['id_recover_test'] = data2['id_recover_test'].astype(str)
|
| 113 |
set_with_dataframe(worksheet2, worksheet2_df)
|
| 114 |
# very important, otherwise gspread will force format IDs in scientific notation by default (making them unusable)
|
| 115 |
worksheet2.format(f"E1:E{len(worksheet2_df.index)+1}", {
|
|
|
|
| 117 |
"type": 'TEXT',
|
| 118 |
},
|
| 119 |
})
|
| 120 |
+
worksheet2.format(f"A1:A{len(worksheet2_df.index)+1}", {
|
| 121 |
+
"numberFormat": {
|
| 122 |
+
"type": 'TEXT',
|
| 123 |
+
},
|
| 124 |
+
})
|
| 125 |
|
| 126 |
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
| 127 |
print(f"Google sheet {name2} successfully updated at {timestamp}!")
|
|
|
|
| 132 |
|
| 133 |
executor = ThreadPoolExecutor(max_workers=1)
|
| 134 |
scheduler = BackgroundScheduler(executors={'default': executor})
|
| 135 |
+
scheduler.add_job(update_google_sheet, trigger='interval', minutes=1, max_instances=1)
|
| 136 |
scheduler.start()
|
| 137 |
|
| 138 |
|