Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
api_test
Browse files
app.py
CHANGED
|
@@ -79,6 +79,36 @@ async def add_exp_hub(ctx):
|
|
| 79 |
print(f"add_exp_hub Error: {e}")
|
| 80 |
|
| 81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
@bot.command(name='get_cell_value')
|
| 83 |
async def get_cell_value(ctx, row, col):
|
| 84 |
cell = worksheet2.cell(row, col)
|
|
|
|
| 79 |
print(f"add_exp_hub Error: {e}")
|
| 80 |
|
| 81 |
|
| 82 |
+
@bot.command(name='api_test')
|
| 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 |
+
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
|
| 112 |
@bot.command(name='get_cell_value')
|
| 113 |
async def get_cell_value(ctx, row, col):
|
| 114 |
cell = worksheet2.cell(row, col)
|