victor HF staff commited on
Commit
39963d4
1 Parent(s): 33838e4
Files changed (1) hide show
  1. index.html +48 -16
index.html CHANGED
@@ -1,19 +1,51 @@
1
  <!DOCTYPE html>
2
  <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>