Spaces:
Sleeping
Sleeping
Upload with huggingface_hub
Browse files- DESCRIPTION.md +1 -0
- README.md +5 -6
- requirements.txt +1 -0
- run.py +36 -0
DESCRIPTION.md
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
A simple dashboard ranking spaces by number of likes.
|
README.md
CHANGED
@@ -1,12 +1,11 @@
|
|
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
colorFrom: indigo
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.6
|
8 |
-
app_file:
|
9 |
pinned: false
|
10 |
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
+
|
2 |
---
|
3 |
+
title: leaderboard_main
|
4 |
+
emoji: 🔥
|
5 |
colorFrom: indigo
|
6 |
+
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
sdk_version: 3.6
|
9 |
+
app_file: run.py
|
10 |
pinned: false
|
11 |
---
|
|
|
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
https://gradio-main-build.s3.amazonaws.com/c3bec6153737855510542e8154391f328ac72606/gradio-3.6-py3-none-any.whl
|
run.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import requests
|
3 |
+
import pandas as pd
|
4 |
+
from huggingface_hub.hf_api import SpaceInfo
|
5 |
+
path = f"https://huggingface.co/api/spaces"
|
6 |
+
|
7 |
+
|
8 |
+
def get_blocks_party_spaces():
|
9 |
+
r = requests.get(path)
|
10 |
+
d = r.json()
|
11 |
+
spaces = [SpaceInfo(**x) for x in d]
|
12 |
+
blocks_spaces = {}
|
13 |
+
for i in range(0,len(spaces)):
|
14 |
+
if spaces[i].id.split('/')[0] == 'Gradio-Blocks' and hasattr(spaces[i], 'likes') and spaces[i].id != 'Gradio-Blocks/Leaderboard' and spaces[i].id != 'Gradio-Blocks/README':
|
15 |
+
blocks_spaces[spaces[i].id]=spaces[i].likes
|
16 |
+
df = pd.DataFrame(
|
17 |
+
[{"Spaces_Name": Spaces, "likes": likes} for Spaces,likes in blocks_spaces.items()])
|
18 |
+
df = df.sort_values(by=['likes'],ascending=False)
|
19 |
+
return df
|
20 |
+
|
21 |
+
block = gr.Blocks()
|
22 |
+
|
23 |
+
with block:
|
24 |
+
gr.Markdown("""Leaderboard for the most popular Blocks Event Spaces. To learn more and join, see <a href="https://huggingface.co/Gradio-Blocks" target="_blank" style="text-decoration: underline">Blocks Party Event</a>""")
|
25 |
+
with gr.Tabs():
|
26 |
+
with gr.TabItem("Blocks Party Leaderboard"):
|
27 |
+
with gr.Row():
|
28 |
+
data = gr.outputs.Dataframe(type="pandas")
|
29 |
+
with gr.Row():
|
30 |
+
data_run = gr.Button("Refresh")
|
31 |
+
data_run.click(get_blocks_party_spaces, inputs=None, outputs=data)
|
32 |
+
# running the function on page load in addition to when the button is clicked
|
33 |
+
block.load(get_blocks_party_spaces, inputs=None, outputs=data)
|
34 |
+
|
35 |
+
block.launch()
|
36 |
+
|