lunarflu HF staff commited on
Commit
bf4124b
·
1 Parent(s): fafa626

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -20
app.py CHANGED
@@ -83,26 +83,27 @@ async def add_exp_hub(ctx):
83
  async def api_test(ctx):
84
  # take nate
85
  column_values_3 = worksheet2.col_values(3)
86
- row_values_2 = worksheet2.row_values(2)
87
-
88
- #for user in column_values_3:
89
- user = "nateraw"
90
- url = f"https://huggingface.co/api/users/{user}/overview"
91
- response = requests.get(url)
92
- if response.status_code == 200:
93
- data = response.json()
94
-
95
- models = data["numModels"]
96
- datasets = data["numDatasets"]
97
- spaces = data["numSpaces"]
98
- discussions = data["numDiscussions"]
99
- papers = data["numPapers"]
100
- upvotes = data["numUpvotes"]
101
- #num_likes = data["numLikes"]
102
-
103
- worksheet2.update(values=[[models, datasets, spaces, discussions, papers, upvotes]], range_name=f'H2:M2')
104
- else:
105
- print(f"Failed to retrieve data. Status code: {response.status_code}")
 
106
 
107
 
108
 
 
83
  async def api_test(ctx):
84
  # take nate
85
  column_values_3 = worksheet2.col_values(3)
86
+ column_values_8 = worksheet2.col_values(8)
87
+ #row_values_2 = worksheet2.row_values(2)
88
+
89
+ for i, user in enumerate(column_values_3):
90
+ if not column_values_8[i]:
91
+ url = f"https://huggingface.co/api/users/{user}/overview"
92
+ response = requests.get(url)
93
+ if response.status_code == 200:
94
+ data = response.json()
95
+
96
+ likes = data["numLikes"]
97
+ models = data["numModels"]
98
+ datasets = data["numDatasets"]
99
+ spaces = data["numSpaces"]
100
+ discussions = data["numDiscussions"]
101
+ papers = data["numPapers"]
102
+ upvotes = data["numUpvotes"]
103
+
104
+ worksheet2.update(values=[[likes, models, datasets, spaces, discussions, papers, upvotes]], range_name=f'G{i+1}:M{i+1}')
105
+ else:
106
+ print(f"Failed to retrieve data. Status code: {response.status_code}")
107
 
108
 
109