sasha's picture
sasha HF staff
stripping it down to the booones
7022131
raw
history blame
2.12 kB
import gradio as gr
import pandas as pd
from huggingface_hub import list_models
def get_submissions(category):
submissions = list_models(filter=["dreambooth-hackathon", category], full=True)
leaderboard_models = []
for submission in submissions:
# user, model, likes
user_id = submission.id.split("/")[0]
leaderboard_models.append(
(
make_clickable_user(user_id),
make_clickable_model(submission.id),
submission.likes,
)
)
df = pd.DataFrame(data=leaderboard_models, columns=["User", "Model", "Likes"])
df.sort_values(by=["Likes"], ascending=False, inplace=True)
df.insert(0, "Rank", list(range(1, len(df) + 1)))
return df
# %% app.ipynb 3
demo = gr.Blocks()
with demo:
gr.Markdown(
"""# Energy Star Leaderboard
TODO """
)
with gr.Tabs():
with gr.TabItem("Text Generation 💬"):
with gr.Row():
animal_data = gr.components.Dataframe(
type="pandas", datatype=["number", "markdown", "markdown", "number"]
)
with gr.TabItem("Image Generation 📷"):
with gr.Row():
science_data = gr.components.Dataframe(
type="pandas", datatype=["number", "markdown", "markdown", "number"]
)
with gr.TabItem("Text Classification 🎭"):
with gr.Row():
food_data = gr.components.Dataframe(
type="pandas", datatype=["number", "markdown", "markdown", "number"]
)
with gr.TabItem("Image Classification 🖼️"):
with gr.Row():
landscape_data = gr.components.Dataframe(
type="pandas", datatype=["number", "markdown", "markdown", "number"]
)
with gr.TabItem("Extractive QA ❔"):
with gr.Row():
wildcard_data = gr.components.Dataframe(
type="pandas", datatype=["number", "markdown", "markdown", "number"]
)
demo.launch()