Spaces:
Sleeping
Sleeping
Commit
•
080c006
0
Parent(s):
Duplicate from keras-dreambooth/leaderboard
Browse filesCo-authored-by: Merve Noyan <[email protected]>
- .gitattributes +34 -0
- README.md +14 -0
- app.py +114 -0
.gitattributes
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Leaderboard
|
3 |
+
emoji: 🌌
|
4 |
+
colorFrom: yellow
|
5 |
+
colorTo: red
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.18.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: true
|
10 |
+
license: apache-2.0
|
11 |
+
duplicated_from: keras-dreambooth/leaderboard
|
12 |
+
---
|
13 |
+
|
14 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
__all__ = ['block', 'make_clickable_model', 'make_clickable_user', 'get_submissions']
|
3 |
+
|
4 |
+
import gradio as gr
|
5 |
+
import pandas as pd
|
6 |
+
from huggingface_hub import HfApi, repocard
|
7 |
+
|
8 |
+
def is_duplicated(space_id:str)->None:
|
9 |
+
card = repocard.RepoCard.load(space_id, repo_type="space")
|
10 |
+
return getattr(card.data, "duplicated_from", None) is not None
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
def make_clickable_model(model_name, link=None):
|
15 |
+
if link is None:
|
16 |
+
link = "https://huggingface.co/" + "spaces/" + model_name
|
17 |
+
return f'<a target="_blank" href="{link}">{model_name.split("/")[-1]}</a>'
|
18 |
+
|
19 |
+
def get_space_ids(category):
|
20 |
+
api = HfApi()
|
21 |
+
spaces = api.list_spaces(filter=["keras-dreambooth", category])
|
22 |
+
print(spaces)
|
23 |
+
space_ids = [x for x in spaces]
|
24 |
+
return space_ids
|
25 |
+
|
26 |
+
|
27 |
+
def make_clickable_user(user_id):
|
28 |
+
link = "https://huggingface.co/" + user_id
|
29 |
+
return f'<a target="_blank" href="{link}">{user_id}</a>'
|
30 |
+
|
31 |
+
def get_submissions(category):
|
32 |
+
submissions = get_space_ids(category)
|
33 |
+
leaderboard_models = []
|
34 |
+
|
35 |
+
for submission in submissions:
|
36 |
+
# user, model, likes
|
37 |
+
if not is_duplicated(submission.id):
|
38 |
+
user_id = submission.id.split("/")[0]
|
39 |
+
leaderboard_models.append(
|
40 |
+
(
|
41 |
+
make_clickable_user(user_id),
|
42 |
+
make_clickable_model(submission.id),
|
43 |
+
submission.likes,
|
44 |
+
)
|
45 |
+
)
|
46 |
+
|
47 |
+
df = pd.DataFrame(data=leaderboard_models, columns=["User", "Space", "Likes"])
|
48 |
+
df.sort_values(by=["Likes"], ascending=False, inplace=True)
|
49 |
+
df.insert(0, "Rank", list(range(1, len(df) + 1)))
|
50 |
+
return df
|
51 |
+
|
52 |
+
block = gr.Blocks()
|
53 |
+
|
54 |
+
with block:
|
55 |
+
gr.Markdown(
|
56 |
+
"""# Keras DreamBooth Leaderboard
|
57 |
+
|
58 |
+
Welcome to the leaderboard for the Keras DreamBooth Event! This is a community event where participants **personalise a Stable Diffusion model** by fine-tuning it with a powerful technique called [_DreamBooth_](https://arxiv.org/abs/2208.12242). This technique allows one to implant a subject into the output domain of the model such that it can be synthesized with a _unique identifier_ in the prompt.
|
59 |
+
|
60 |
+
This competition is composed of 4 _themes_, where each theme will collect models belong to one of the categories shown in the tabs below. We'll be **giving out prizes to the top 3 most liked models per theme**, and you're encouraged to submit as many models as you want!
|
61 |
+
|
62 |
+
"""
|
63 |
+
)
|
64 |
+
with gr.Tabs():
|
65 |
+
with gr.TabItem("Nature 🐨 🌳 "):
|
66 |
+
with gr.Row():
|
67 |
+
nature_data = gr.components.Dataframe(
|
68 |
+
type="pandas", datatype=["number", "markdown", "markdown", "number"]
|
69 |
+
)
|
70 |
+
with gr.Row():
|
71 |
+
data_run = gr.Button("Refresh")
|
72 |
+
data_run.click(
|
73 |
+
get_submissions, inputs=gr.Variable("nature"), outputs=nature_data
|
74 |
+
)
|
75 |
+
with gr.TabItem("Science Fiction & Fantasy 🧙♀️ 🧛♀️ 🤖 "):
|
76 |
+
with gr.Row():
|
77 |
+
scifi_data = gr.components.Dataframe(
|
78 |
+
type="pandas", datatype=["number", "markdown", "markdown", "number"]
|
79 |
+
)
|
80 |
+
with gr.Row():
|
81 |
+
data_run = gr.Button("Refresh")
|
82 |
+
data_run.click(
|
83 |
+
get_submissions, inputs=gr.Variable("scifi"), outputs=scifi_data
|
84 |
+
)
|
85 |
+
with gr.TabItem("Consentful 🖼️ 🎨 "):
|
86 |
+
with gr.Row():
|
87 |
+
consentful_data = gr.components.Dataframe(
|
88 |
+
type="pandas", datatype=["number", "markdown", "markdown", "number"]
|
89 |
+
)
|
90 |
+
with gr.Row():
|
91 |
+
data_run = gr.Button("Refresh")
|
92 |
+
data_run.click(
|
93 |
+
get_submissions, inputs=gr.Variable("consentful"), outputs=consentful_data
|
94 |
+
)
|
95 |
+
with gr.TabItem("Wild Card 🃏"):
|
96 |
+
with gr.Row():
|
97 |
+
wildcard_data = gr.components.Dataframe(
|
98 |
+
type="pandas", datatype=["number", "markdown", "markdown", "number"]
|
99 |
+
)
|
100 |
+
with gr.Row():
|
101 |
+
data_run = gr.Button("Refresh")
|
102 |
+
data_run.click(
|
103 |
+
get_submissions,
|
104 |
+
inputs=gr.Variable("wildcard"),
|
105 |
+
outputs=wildcard_data,
|
106 |
+
)
|
107 |
+
|
108 |
+
block.load(get_submissions, inputs=gr.Variable("nature"), outputs=nature_data)
|
109 |
+
block.load(get_submissions, inputs=gr.Variable("scifi"), outputs=scifi_data)
|
110 |
+
block.load(get_submissions, inputs=gr.Variable("consentful"), outputs=consentful_data)
|
111 |
+
block.load(get_submissions, inputs=gr.Variable("wildcard"), outputs=wildcard_data)
|
112 |
+
|
113 |
+
|
114 |
+
block.launch()
|