Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
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 |
-
|
87 |
-
|
88 |
-
|
89 |
-
user
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
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 |
|