init
Browse files- index.html +48 -16
index.html
CHANGED
@@ -1,19 +1,51 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
</html>
|
|
|
1 |
<!DOCTYPE html>
|
2 |
<html>
|
3 |
+
<head>
|
4 |
+
<meta charset="utf-8" />
|
5 |
+
<meta name="viewport" content="width=device-width" />
|
6 |
+
<title>Diffusers gallery</title>
|
7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
+
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script>
|
9 |
+
|
10 |
+
<script>
|
11 |
+
async function fetchFirstImage(url) {
|
12 |
+
const response = await fetch(url);
|
13 |
+
const text = await response.text();
|
14 |
+
const imageRegex = /!\[.*\]\((.*)\)/;
|
15 |
+
const match = text.match(imageRegex);
|
16 |
+
return match ? match[1] : null;
|
17 |
+
}
|
18 |
+
</script>
|
19 |
+
</head>
|
20 |
+
<body>
|
21 |
+
<div class="card">
|
22 |
+
<h1>Welcome to your static Space!</h1>
|
23 |
+
<section
|
24 |
+
class="container mx-auto grid grid-cols-3"
|
25 |
+
x-data="{models: [], fetchFirstImage}"
|
26 |
+
x-init="{models} = await fetch('https://huggingface.co/models-json?pipeline_tag=text-to-image&sort=likes').then(data => data.json())"
|
27 |
+
>
|
28 |
+
<template x-for="model in models">
|
29 |
+
<a
|
30 |
+
:href="`https://huggingface.co/${model.id}`"
|
31 |
+
class="block mb-5 bg-gray-100 rounded-xl overflow-hidden relative grid-item group"
|
32 |
+
>
|
33 |
+
<div
|
34 |
+
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"
|
35 |
+
>
|
36 |
+
<div class="text-sm flex group-hover:translate-x-0.5 transition"><span x-text="model.likes"></span></div>
|
37 |
+
<div x-text="model.id" class="text-xl font-semibold group-hover:translate-x-0.5 transition"></div>
|
38 |
+
</div>
|
39 |
+
<div
|
40 |
+
class="group-hover:brightness-90"
|
41 |
+
x-data="{img: ''}"
|
42 |
+
x-init="img = await fetchFirstImage(`https://huggingface.co/${model.id}/raw/main/README.md`)"
|
43 |
+
>
|
44 |
+
<img :src="img" alt="" class="w-full" />
|
45 |
+
</div>
|
46 |
+
</a>
|
47 |
+
</template>
|
48 |
+
</section>
|
49 |
+
</div>
|
50 |
+
</body>
|
51 |
</html>
|