Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -107,7 +107,7 @@ def update_google_sheet():
|
|
107 |
|
108 |
executor = ThreadPoolExecutor(max_workers=1)
|
109 |
scheduler = BackgroundScheduler(executors={'default': executor})
|
110 |
-
scheduler.add_job(update_google_sheet, trigger='interval', minutes=
|
111 |
scheduler.start()
|
112 |
|
113 |
|
@@ -125,7 +125,6 @@ async def periodic_api_test(): # needs rewrite, can do same thing and interact w
|
|
125 |
try:
|
126 |
# this should be gspread type function (do not mix with discord at all)
|
127 |
global worksheet2_df
|
128 |
-
await asyncio.sleep(5)
|
129 |
# get
|
130 |
for index, user in enumerate(worksheet2_df['hf_user_name']):
|
131 |
if user in processed_users:
|
@@ -146,10 +145,12 @@ async def periodic_api_test(): # needs rewrite, can do same thing and interact w
|
|
146 |
upvotes = data["numUpvotes"]
|
147 |
|
148 |
worksheet2_df.loc[index:index, 'likes':'upvotes'] = [[likes, models, datasets, spaces, discussions, papers, upvotes]]
|
|
|
149 |
print(worksheet2_df)
|
150 |
|
151 |
|
152 |
processed_users.add(user)
|
|
|
153 |
else:
|
154 |
print(f"Failed to retrieve data for user {user}. Status code: {response.status_code}")
|
155 |
|
|
|
107 |
|
108 |
executor = ThreadPoolExecutor(max_workers=1)
|
109 |
scheduler = BackgroundScheduler(executors={'default': executor})
|
110 |
+
scheduler.add_job(update_google_sheet, trigger='interval', minutes=5, max_instances=1)
|
111 |
scheduler.start()
|
112 |
|
113 |
|
|
|
125 |
try:
|
126 |
# this should be gspread type function (do not mix with discord at all)
|
127 |
global worksheet2_df
|
|
|
128 |
# get
|
129 |
for index, user in enumerate(worksheet2_df['hf_user_name']):
|
130 |
if user in processed_users:
|
|
|
145 |
upvotes = data["numUpvotes"]
|
146 |
|
147 |
worksheet2_df.loc[index:index, 'likes':'upvotes'] = [[likes, models, datasets, spaces, discussions, papers, upvotes]]
|
148 |
+
pd.set_option('display.max_rows', 30)
|
149 |
print(worksheet2_df)
|
150 |
|
151 |
|
152 |
processed_users.add(user)
|
153 |
+
print(processed_users)
|
154 |
else:
|
155 |
print(f"Failed to retrieve data for user {user}. Status code: {response.status_code}")
|
156 |
|