Spaces:
Runtime error
Runtime error
File size: 1,325 Bytes
48dea0e b95b59c 48dea0e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
import os
import requests
import pandas as pd
import gradio as gr
from huggingface_hub.hf_api import SpaceInfo
from pathlib import Path
path = f"https://huggingface.co/api/spaces"
def get_ECCV_spaces():
r = requests.get(path)
d = r.json()
spaces = [SpaceInfo(**x) for x in d]
spaces = [x for x in spaces if x.id.startswith("ECCV2022") and hasattr(x, 'likes') and x.id != 'ECCV2022/Leaderboard' and x.id != 'ECCV2022/README']
blocks_spaces = {x.id: x.likes for x in spaces}
df = pd.DataFrame(
[{"Spaces_Name": Spaces, "likes": likes} for Spaces,likes in blocks_spaces.items()])
df = df.sort_values(by=['likes'],ascending=False)
return df
block = gr.Blocks()
with block:
gr.Markdown("""Leaderboard for the most popular ECCV 2022 Spaces. To learn more and join, see <a href="https://huggingface.co/ECCV2022" target="_blank" style="text-decoration: underline">ECCV 2022 Event</a>""")
with gr.Tabs():
with gr.TabItem("ECCV 2022 Leaderboard"):
with gr.Row():
data = gr.Dataframe(type="pandas")
with gr.Row():
data_run = gr.Button("Refresh")
data_run.click(get_ECCV_spaces, inputs=None, outputs=data)
block.load(get_ECCV_spaces, inputs=None, outputs=data)
block.launch() |