lunarflu HF staff commited on
Commit
ea2e1d2
·
verified ·
1 Parent(s): e6f260b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -36
app.py CHANGED
@@ -119,42 +119,7 @@ def calculate_xp(level):
119
  return (int(level ** 3))
120
 
121
 
122
- processed_users = set()
123
-
124
- async def periodic_api_test(): # needs rewrite, can do same thing and interact with csv -> push to google sheets
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:
132
- continue
133
-
134
- url = f"https://huggingface.co/api/users/{user}/overview"
135
- response = requests.get(url)
136
-
137
- if response.status_code == 200:
138
- data = response.json()
139
-
140
- likes = data["numLikes"]
141
- models = data["numModels"]
142
- datasets = data["numDatasets"]
143
- spaces = data["numSpaces"]
144
- discussions = data["numDiscussions"]
145
- papers = data["numPapers"]
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
-
156
- except Exception as e:
157
- print(f"periodic_api_test Error: {e}")
158
 
159
 
160
  async def add_exp(member_id):
 
119
  return (int(level ** 3))
120
 
121
 
122
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
 
124
 
125
  async def add_exp(member_id):