prettier
Browse files- index.html +261 -195
index.html
CHANGED
@@ -1,204 +1,270 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
<html>
|
|
|
|
|
|
|
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 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
import Intersect from "https://cdn.skypack.dev/@alpinejs/intersect";
|
52 |
-
Alpine.plugin(Intersect);
|
53 |
-
|
54 |
-
Alpine.data("modelsData", () => ({
|
55 |
-
async init() {
|
56 |
-
const data = await this.getModels(this.page, this.sort, this.filter);
|
57 |
-
this.models = data.models
|
58 |
-
this.totalPages = data.totalPages;
|
59 |
-
},
|
60 |
-
ASSETS_URL: "https://d26smi9133w0oo.cloudfront.net/diffusers-gallery/",
|
61 |
-
models: [],
|
62 |
-
filter: "all",
|
63 |
-
sort: "trending",
|
64 |
-
page: 1,
|
65 |
-
totalPages: -1,
|
66 |
-
buttonClass(attr, filter) {
|
67 |
-
if (this[attr] === filter) {
|
68 |
-
return "bg-black dark:bg-white shadow-lg text-white dark:text-black"
|
69 |
-
}
|
70 |
-
return "text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-500 hover:text-gray-800"
|
71 |
-
},
|
72 |
-
async filterModels(style) {
|
73 |
-
this.filter = style
|
74 |
-
this.page = 1
|
75 |
-
const data = await this.getModels(this.page, this.sort, this.filter)
|
76 |
-
this.models = data.models
|
77 |
-
this.totalPages = data.totalPages
|
78 |
-
},
|
79 |
-
async sortModels(sort) {
|
80 |
-
this.sort = sort
|
81 |
-
this.page = 1
|
82 |
-
const data = await this.getModels(this.page, this.sort, this.filter);
|
83 |
-
this.models = data.models;
|
84 |
-
this.totalPages = data.totalPages;
|
85 |
-
},
|
86 |
-
async getModels(page, sort, style) {
|
87 |
-
// const res = await fetch(`http://localhost:8000/api/models?page=${page}&sort=${sort}&style=${style}`)
|
88 |
-
const res = await fetch(`https://huggingface-projects-diffusers-gallery-bot.hf.space/api/models?page=${page}&sort=${sort}&style=${style}`);
|
89 |
-
const data = await res.json();
|
90 |
-
const models = data.models.map((model) => ({
|
91 |
-
id: model.id,
|
92 |
-
likes: model.likes,
|
93 |
-
class: model.class,
|
94 |
-
isNFSW: model.isNFSW,
|
95 |
-
images: model.images.filter((image) => image && image.endsWith(".jpg")),
|
96 |
-
}));
|
97 |
-
|
98 |
-
return {
|
99 |
-
models,
|
100 |
-
totalPages: data.totalPages
|
101 |
-
}
|
102 |
-
},
|
103 |
-
async nextPage() {
|
104 |
-
if (this.page < this.totalPages) {
|
105 |
-
this.page += 1;
|
106 |
const data = await this.getModels(this.page, this.sort, this.filter);
|
107 |
-
this.models =
|
108 |
this.totalPages = data.totalPages;
|
109 |
-
}
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
</div>
|
153 |
-
|
154 |
-
|
155 |
-
<
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
</div>
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
<div
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
<
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
</div>
|
188 |
-
<div
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
|
|
|
|
198 |
</template>
|
199 |
-
|
200 |
-
|
201 |
-
</
|
202 |
-
</
|
203 |
-
|
204 |
-
</html>
|
|
|
1 |
<!DOCTYPE html>
|
2 |
<html>
|
3 |
+
<head>
|
4 |
+
<meta charset="utf-8" />
|
5 |
+
<meta name="viewport" content="width=device-width" />
|
6 |
|
7 |
+
<title>Diffusers gallery</title>
|
8 |
+
<meta name="description" content="Discover all difussion models on the Hugging Face hub." />
|
9 |
+
|
10 |
+
<meta property="og:url" content="https://huggingface-projects-diffusers-gallery.hf.space/" />
|
11 |
+
<meta property="og:type" content="website" />
|
12 |
+
<meta property="og:title" content="Hugging Face - Diffusers Models Gallery" />
|
13 |
+
<meta property="og:description" content="Discover all difussion models on the Hugging Face hub." />
|
14 |
+
<meta property="og:image" content="https://huggingface-projects-diffusers-gallery.hf.space/Fo6vR6JX0AEjbw1.jpeg" />
|
15 |
+
|
16 |
+
<meta name="twitter:card" content="player" />
|
17 |
+
<meta property="twitter:url" content="https://huggingface-projects-diffusers-gallery.hf.space/" />
|
18 |
+
<meta name="twitter:description" content="Discover all difussion models on the Hugging Face hub." />
|
19 |
+
|
20 |
+
<meta name="twitter:site" content="@huggingface" />
|
21 |
+
<meta name="twitter:title" content="Hugging Face - Diffusers Models Gallery" />
|
22 |
+
|
23 |
+
<meta name="twitter:image" content="https://huggingface-projects-diffusers-gallery.hf.space/Fo6vR6JX0AEjbw1.jpeg" />
|
24 |
+
<meta name="twitter:player" content="https://huggingface-projects-diffusers-gallery.hf.space/index.html" />
|
25 |
+
<meta name="twitter:player:width" content="100%" />
|
26 |
+
<meta name="twitter:player:height" content="600" />
|
27 |
+
|
28 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"></script>
|
29 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
30 |
+
<style>
|
31 |
+
body,
|
32 |
+
html {
|
33 |
+
height: 100%;
|
34 |
+
}
|
35 |
+
|
36 |
+
details > summary {
|
37 |
+
list-style: none;
|
38 |
+
}
|
39 |
+
|
40 |
+
details > summary::-webkit-details-marker {
|
41 |
+
display: none;
|
42 |
+
}
|
43 |
+
</style>
|
44 |
+
|
45 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
46 |
+
|
47 |
+
<script type="module">
|
48 |
+
import Alpine from "https://cdn.skypack.dev/alpinejs";
|
49 |
+
import Intersect from "https://cdn.skypack.dev/@alpinejs/intersect";
|
50 |
+
Alpine.plugin(Intersect);
|
51 |
+
|
52 |
+
Alpine.data("modelsData", () => ({
|
53 |
+
async init() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
const data = await this.getModels(this.page, this.sort, this.filter);
|
55 |
+
this.models = data.models;
|
56 |
this.totalPages = data.totalPages;
|
57 |
+
},
|
58 |
+
ASSETS_URL: "https://d26smi9133w0oo.cloudfront.net/diffusers-gallery/",
|
59 |
+
models: [],
|
60 |
+
filter: "all",
|
61 |
+
sort: "trending",
|
62 |
+
page: 1,
|
63 |
+
totalPages: -1,
|
64 |
+
buttonClass(attr, filter) {
|
65 |
+
if (this[attr] === filter) {
|
66 |
+
return "bg-black dark:bg-white shadow-lg text-white dark:text-black";
|
67 |
+
}
|
68 |
+
return "text-gray-600 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-500 hover:text-gray-800";
|
69 |
+
},
|
70 |
+
async filterModels(style) {
|
71 |
+
this.filter = style;
|
72 |
+
this.page = 1;
|
73 |
+
const data = await this.getModels(this.page, this.sort, this.filter);
|
74 |
+
this.models = data.models;
|
75 |
+
this.totalPages = data.totalPages;
|
76 |
+
},
|
77 |
+
async sortModels(sort) {
|
78 |
+
this.sort = sort;
|
79 |
+
this.page = 1;
|
80 |
+
const data = await this.getModels(this.page, this.sort, this.filter);
|
81 |
+
this.models = data.models;
|
82 |
+
this.totalPages = data.totalPages;
|
83 |
+
},
|
84 |
+
async getModels(page, sort, style) {
|
85 |
+
// const res = await fetch(`http://localhost:8000/api/models?page=${page}&sort=${sort}&style=${style}`)
|
86 |
+
const res = await fetch(
|
87 |
+
`https://huggingface-projects-diffusers-gallery-bot.hf.space/api/models?page=${page}&sort=${sort}&style=${style}`
|
88 |
+
);
|
89 |
+
const data = await res.json();
|
90 |
+
const models = data.models.map((model) => ({
|
91 |
+
id: model.id,
|
92 |
+
likes: model.likes,
|
93 |
+
class: model.class,
|
94 |
+
isNFSW: model.isNFSW,
|
95 |
+
images: model.images.filter((image) => image && image.endsWith(".jpg")),
|
96 |
+
}));
|
97 |
+
|
98 |
+
return {
|
99 |
+
models,
|
100 |
+
totalPages: data.totalPages,
|
101 |
+
};
|
102 |
+
},
|
103 |
+
async nextPage() {
|
104 |
+
if (this.page < this.totalPages) {
|
105 |
+
this.page += 1;
|
106 |
+
const data = await this.getModels(this.page, this.sort, this.filter);
|
107 |
+
this.models = this.models.concat(data.models);
|
108 |
+
this.totalPages = data.totalPages;
|
109 |
+
}
|
110 |
+
},
|
111 |
+
}));
|
112 |
+
Alpine.start();
|
113 |
+
</script>
|
114 |
+
</head>
|
115 |
+
|
116 |
+
<body class="pb-10 pt-5 bg-gray-100 dark:bg-gray-900 relative">
|
117 |
+
<section
|
118 |
+
class="container px-6 grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 mx-auto relative"
|
119 |
+
x-data="modelsData"
|
120 |
+
>
|
121 |
+
<div class="col-span-2 lg:col-span-1 flex flex-col gap-2 row-start">
|
122 |
+
<h1 class="text-lg font-semibold dark:text-white whitespace-nowrap">Diffusers Models Gallery</h1>
|
123 |
+
<details>
|
124 |
+
<summary
|
125 |
+
class="text-xs font-thin cursor-pointer focus:outline-none focus:shadow-outline-gray dark:text-white"
|
126 |
+
>
|
127 |
+
About
|
128 |
+
</summary>
|
129 |
+
<p class="text-xs font-thin dark:text-white">
|
130 |
+
The gallery only displays models with valid images in the model card, and the classifiers use the first
|
131 |
+
image in the card.
|
132 |
+
|
133 |
+
<a href="https://huggingface.co/cafeai/cafe_style" class="text-blue-500 hover:underline" target="_blank"
|
134 |
+
>cafeai/cafe_style</a
|
135 |
+
>
|
136 |
+
generates style tags, while
|
137 |
+
<a
|
138 |
+
href="https://huggingface.co/carbon225/vit-base-patch16-224-hentai"
|
139 |
+
class="text-blue-500 hover:underline"
|
140 |
+
target="_blank"
|
141 |
+
>carbon225/vit-base-patch16-224-hentai</a
|
142 |
+
>
|
143 |
+
generates NSFW tags. Test both models at
|
144 |
+
<a
|
145 |
+
href="https://huggingface.co/spaces/radames/aesthetic-style-nsfw-classifier"
|
146 |
+
class="text-blue-500 hover:underline"
|
147 |
+
target="_blank"
|
148 |
+
>radames/aesthetic-style-nsfw-classifier</a
|
149 |
+
>. The models are not perfect and may make mistakes. Sorry.
|
150 |
+
</p>
|
151 |
+
</details>
|
152 |
</div>
|
153 |
+
|
154 |
+
<div class="col-span-2 md:col-span-3 flex items-center gap-2 flex flex-wrap lg-auto lg:ml-auto">
|
155 |
+
<div class="flex text-xs gap-2">
|
156 |
+
<span class="md:px-3 py-1 font-thin dark:text-white">sort by</span>
|
157 |
+
<button
|
158 |
+
:class="buttonClass('sort', 'trending')"
|
159 |
+
class="px-2 md:px-3 py-1 rounded-full text"
|
160 |
+
@click="sortModels('trending')"
|
161 |
+
>
|
162 |
+
Trending
|
163 |
+
</button>
|
164 |
+
<button
|
165 |
+
:class="buttonClass('sort', 'recent')"
|
166 |
+
class="text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-500 hover:text-gray-800 px-2 md:px-3 py-1 rounded-full"
|
167 |
+
@click="sortModels('recent')"
|
168 |
+
>
|
169 |
+
Recent
|
170 |
+
</button>
|
171 |
+
<button
|
172 |
+
:class="buttonClass('sort', 'likes')"
|
173 |
+
class="text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-500 hover:text-gray-800 px-2 md:px-3 py-1 rounded-full"
|
174 |
+
@click="sortModels('likes')"
|
175 |
+
>
|
176 |
+
Most Likes
|
177 |
+
</button>
|
178 |
+
</div>
|
179 |
+
<div class="flex text-xs gap-2">
|
180 |
+
<span class="md:px-3 py-1 font-thin dark:text-white"> style</span>
|
181 |
+
<button
|
182 |
+
:class="buttonClass('filter', 'all')"
|
183 |
+
class="px-2 md:px-3 py-1 rounded-full"
|
184 |
+
@click="filterModels('all')"
|
185 |
+
>
|
186 |
+
All
|
187 |
+
</button>
|
188 |
+
<button
|
189 |
+
:class="buttonClass('filter', 'anime')"
|
190 |
+
class="text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-500 hover:text-gray-800 px-2 md:px-3 py-1 rounded-full"
|
191 |
+
@click="filterModels('anime')"
|
192 |
+
>
|
193 |
+
Anime
|
194 |
+
</button>
|
195 |
+
<button
|
196 |
+
:class="buttonClass('filter', '3d')"
|
197 |
+
class="text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-500 hover:text-gray-800 px-2 md:px-3 py-1 rounded-full"
|
198 |
+
@click="filterModels('3d')"
|
199 |
+
>
|
200 |
+
3D
|
201 |
+
</button>
|
202 |
+
<button
|
203 |
+
:class="buttonClass('filter', 'realistic')"
|
204 |
+
class="text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-500 hover:text-gray-800 px-2 md:px-3 py-1 rounded-full"
|
205 |
+
@click="filterModels('realistic')"
|
206 |
+
>
|
207 |
+
Realistic
|
208 |
+
</button>
|
209 |
+
<button
|
210 |
+
:class="buttonClass('filter', 'nsfw')"
|
211 |
+
class="text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-500 hover:text-gray-800 px-2 md:px-3 py-1 rounded-full"
|
212 |
+
@click="filterModels('nsfw')"
|
213 |
+
>
|
214 |
+
18+
|
215 |
+
</button>
|
216 |
+
</div>
|
217 |
</div>
|
218 |
+
|
219 |
+
<template x-for="model in models" :key="model.id">
|
220 |
+
<template x-if="model.images.length > 0">
|
221 |
+
<a
|
222 |
+
:href="`https://huggingface.co/${model.id}`"
|
223 |
+
class="block bg-gray-900 rounded-xl overflow-hidden relative group aspect-square text-white"
|
224 |
+
target="_blank"
|
225 |
+
>
|
226 |
+
<div
|
227 |
+
class="absolute bottom-0 p-4 bg-gradient-to-t text-white pt-10 from-black/90 via-black/70 to-transparent w-full z-10"
|
228 |
+
>
|
229 |
+
<div class="text-sm flex items-center group-hover:translate-x-0.5 transition">
|
230 |
+
<svg
|
231 |
+
class="mr-1.5 text-white/70"
|
232 |
+
xmlns="http://www.w3.org/2000/svg"
|
233 |
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
234 |
+
aria-hidden="true"
|
235 |
+
focusable="false"
|
236 |
+
role="img"
|
237 |
+
width="1em"
|
238 |
+
height="1em"
|
239 |
+
preserveAspectRatio="xMidYMid meet"
|
240 |
+
viewBox="0 0 32 32"
|
241 |
+
fill="currentColor"
|
242 |
+
>
|
243 |
+
<path
|
244 |
+
d="M22.5,4c-2,0-3.9,0.8-5.3,2.2L16,7.4l-1.1-1.1C12,3.3,7.2,3.3,4.3,6.2c0,0-0.1,0.1-0.1,0.1c-3,3-3,7.8,0,10.8L16,29l11.8-11.9c3-3,3-7.8,0-10.8C26.4,4.8,24.5,4,22.5,4z"
|
245 |
+
></path>
|
246 |
+
</svg>
|
247 |
+
<span x-text="model.likes"></span>
|
248 |
+
</div>
|
249 |
+
<div
|
250 |
+
x-text="model.id"
|
251 |
+
class="text-base md:text-lg lg:text-xl font-semibold group-hover:translate-x-0.5 transition"
|
252 |
+
></div>
|
253 |
</div>
|
254 |
+
<div class="group-hover:brightness-90 h-full" :class="model.isNFSW ? 'blur-md' : ''">
|
255 |
+
<template x-if="model.images[0]">
|
256 |
+
<img
|
257 |
+
:src="()=> ASSETS_URL + model.images[0]"
|
258 |
+
:alt="model.id"
|
259 |
+
alt=""
|
260 |
+
class="w-full h-full object-cover group-hover:scale-[1.01] transition"
|
261 |
+
/>
|
262 |
+
</template>
|
263 |
+
</div>
|
264 |
+
</a>
|
265 |
+
</template>
|
266 |
</template>
|
267 |
+
<div class="h-12 relative" x-intersect="nextPage" data-iframe-height></div>
|
268 |
+
</section>
|
269 |
+
</body>
|
270 |
+
</html>
|
|
|
|