Commit
·
d0f45dd
1
Parent(s):
81b0d11
Update metadata and API filter for smolagents and tools gallery
Browse files- index.html +54 -24
index.html
CHANGED
|
@@ -4,24 +4,24 @@
|
|
| 4 |
<meta charset="utf-8" />
|
| 5 |
<meta name="viewport" content="width=device-width" />
|
| 6 |
|
| 7 |
-
<title>
|
| 8 |
-
<meta name="description" content="Discover all
|
| 9 |
|
| 10 |
-
<meta property="og:url" content="https://
|
| 11 |
<meta property="og:type" content="website" />
|
| 12 |
-
<meta property="og:title" content="
|
| 13 |
-
<meta property="og:description" content="Discover all
|
| 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://
|
| 18 |
-
<meta name="twitter:description" content="Discover all
|
| 19 |
|
| 20 |
<meta name="twitter:site" content="@huggingface" />
|
| 21 |
-
<meta name="twitter:title" content="
|
| 22 |
|
| 23 |
<meta name="twitter:image" content="https://huggingface-projects-diffusers-gallery.hf.space/Fo6vR6JX0AEjbw1.jpeg" />
|
| 24 |
-
<meta name="twitter:player" content="https://
|
| 25 |
<meta name="twitter:player:width" content="100%" />
|
| 26 |
<meta name="twitter:player:height" content="600" />
|
| 27 |
|
|
@@ -29,13 +29,13 @@
|
|
| 29 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 30 |
|
| 31 |
<style>
|
| 32 |
-
|
| 33 |
iframe {
|
| 34 |
display: block;
|
| 35 |
border: none;
|
| 36 |
width: 100%;
|
| 37 |
height: 600px;
|
| 38 |
pointer-events: none;
|
|
|
|
| 39 |
}
|
| 40 |
|
| 41 |
.grid-container {
|
|
@@ -64,6 +64,19 @@
|
|
| 64 |
display: block;
|
| 65 |
z-index: 1;
|
| 66 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
</style>
|
| 68 |
|
| 69 |
<script type="module">
|
|
@@ -78,7 +91,7 @@
|
|
| 78 |
this.totalPages = data.totalPages;
|
| 79 |
},
|
| 80 |
themes: [],
|
| 81 |
-
filter: "
|
| 82 |
sort: "likes",
|
| 83 |
page: 1,
|
| 84 |
totalPages: -1,
|
|
@@ -108,6 +121,13 @@
|
|
| 108 |
this.themes = data.themes;
|
| 109 |
this.totalPages = data.totalPages;
|
| 110 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
async getThemes(page, sort, useTestData) {
|
| 112 |
let data;
|
| 113 |
if (useTestData) {
|
|
@@ -116,8 +136,9 @@
|
|
| 116 |
);
|
| 117 |
data = await res.json();
|
| 118 |
} else {
|
|
|
|
| 119 |
const res = await fetch(
|
| 120 |
-
|
| 121 |
);
|
| 122 |
data = await res.json();
|
| 123 |
console.log(data)
|
|
@@ -164,14 +185,29 @@
|
|
| 164 |
>
|
| 165 |
<section class="container px-6 grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-14 mx-auto relative">
|
| 166 |
<div class="col-span-2 lg:col-span-1 flex flex-col gap-14 row-start">
|
| 167 |
-
<h1 class="text-lg font-semibold text-gray-800 whitespace-nowrap">
|
| 168 |
</div>
|
| 169 |
<div class="col-span-2 md:col-span-3 flex items-center gap-14 flex flex-wrap lg-auto lg:ml-auto text-sm">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
<div class="flex gap-2">
|
| 171 |
<span class="md:px-3 py-1 text-gray-800">sort by</span>
|
| 172 |
<button
|
| 173 |
-
|
| 174 |
-
|
| 175 |
>
|
| 176 |
Most Likes
|
| 177 |
</button>
|
|
@@ -183,23 +219,17 @@
|
|
| 183 |
</button>
|
| 184 |
</div>
|
| 185 |
<div class="flex gap-0">
|
| 186 |
-
<!-- <input type="checkbox" @click="switchData()" class="rounded accent-orange-300">
|
| 187 |
-
<span class="md:px-3 py-1 text-gray-800 ml-0">Use Test Data</span> -->
|
| 188 |
<input type="checkbox" @click="switchTheme()" class="rounded accent-orange-300">
|
| 189 |
<span class="md:px-3 py-1 text-gray-800 ml-0">Show Dark Mode</span>
|
| 190 |
-
<!-- <button
|
| 191 |
-
:class="buttonClass('useTestData', false)"
|
| 192 |
-
class="px-2 md:px-3 py-1 rounded-full"
|
| 193 |
-
@click="switchData()"
|
| 194 |
-
>
|
| 195 |
-
Use Test Data
|
| 196 |
-
</button> -->
|
| 197 |
</div>
|
| 198 |
</div>
|
| 199 |
</section>
|
| 200 |
<div class="container px-6 grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2 mx-auto my-8 relative">
|
| 201 |
<template x-for="theme in themes" :key="theme.id">
|
| 202 |
<div class="grid-item">
|
|
|
|
|
|
|
|
|
|
| 203 |
<iframe :src="`${theme.subdomain}?_=${new Date().getTime()}&__theme=${mode}`" :alt="theme.id" scrolling="no" frameborder="0" loading="lazy"></iframe>
|
| 204 |
<a :href="`https://huggingface.co/spaces/${theme.id}`" target="_blank"></a>
|
| 205 |
</div>
|
|
|
|
| 4 |
<meta charset="utf-8" />
|
| 5 |
<meta name="viewport" content="width=device-width" />
|
| 6 |
|
| 7 |
+
<title>Smolagents and tools gallery</title>
|
| 8 |
+
<meta name="description" content="Discover all smolagents and tools created by the community." />
|
| 9 |
|
| 10 |
+
<meta property="og:url" content="https://smolagents-tools-gallery.hf.space/" />
|
| 11 |
<meta property="og:type" content="website" />
|
| 12 |
+
<meta property="og:title" content="smolagents and tools gallery" />
|
| 13 |
+
<meta property="og:description" content="Discover all smolagents and tools created by the community." />
|
| 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://davidberenstein1957-smolagents-and-tools.static.hf.space" />
|
| 18 |
+
<meta name="twitter:description" content="Discover all smolagents and tools created by the community." />
|
| 19 |
|
| 20 |
<meta name="twitter:site" content="@huggingface" />
|
| 21 |
+
<meta name="twitter:title" content="smolagents and tools gallery" />
|
| 22 |
|
| 23 |
<meta name="twitter:image" content="https://huggingface-projects-diffusers-gallery.hf.space/Fo6vR6JX0AEjbw1.jpeg" />
|
| 24 |
+
<meta name="twitter:player" content="https://davidberenstein1957-smolagents-and-tools.static.hf.space" />
|
| 25 |
<meta name="twitter:player:width" content="100%" />
|
| 26 |
<meta name="twitter:player:height" content="600" />
|
| 27 |
|
|
|
|
| 29 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 30 |
|
| 31 |
<style>
|
|
|
|
| 32 |
iframe {
|
| 33 |
display: block;
|
| 34 |
border: none;
|
| 35 |
width: 100%;
|
| 36 |
height: 600px;
|
| 37 |
pointer-events: none;
|
| 38 |
+
margin-top: 32px; /* Match header height */
|
| 39 |
}
|
| 40 |
|
| 41 |
.grid-container {
|
|
|
|
| 64 |
display: block;
|
| 65 |
z-index: 1;
|
| 66 |
}
|
| 67 |
+
|
| 68 |
+
.grid-item-header {
|
| 69 |
+
position: absolute;
|
| 70 |
+
top: 0;
|
| 71 |
+
left: 0;
|
| 72 |
+
right: 0;
|
| 73 |
+
height: 32px;
|
| 74 |
+
background: rgba(0,0,0,0.5);
|
| 75 |
+
padding: 8px;
|
| 76 |
+
z-index: 10;
|
| 77 |
+
display: flex;
|
| 78 |
+
align-items: center;
|
| 79 |
+
}
|
| 80 |
</style>
|
| 81 |
|
| 82 |
<script type="module">
|
|
|
|
| 91 |
this.totalPages = data.totalPages;
|
| 92 |
},
|
| 93 |
themes: [],
|
| 94 |
+
filter: "tool",
|
| 95 |
sort: "likes",
|
| 96 |
page: 1,
|
| 97 |
totalPages: -1,
|
|
|
|
| 121 |
this.themes = data.themes;
|
| 122 |
this.totalPages = data.totalPages;
|
| 123 |
},
|
| 124 |
+
async filterType(filter) {
|
| 125 |
+
this.filter = filter;
|
| 126 |
+
this.page = 1;
|
| 127 |
+
const data = await this.getThemes(this.page, this.sort, this.useTestData);
|
| 128 |
+
this.themes = data.themes;
|
| 129 |
+
this.totalPages = data.totalPages;
|
| 130 |
+
},
|
| 131 |
async getThemes(page, sort, useTestData) {
|
| 132 |
let data;
|
| 133 |
if (useTestData) {
|
|
|
|
| 136 |
);
|
| 137 |
data = await res.json();
|
| 138 |
} else {
|
| 139 |
+
const searchFilters = this.filter === 'tool' ? 'tool' : '(smolagent OR agent OR smolagents)';
|
| 140 |
const res = await fetch(
|
| 141 |
+
`https://huggingface.co/api/spaces?limit=100&filter=${searchFilters}&expand[]=subdomain&expand[]=lastModified&expand[]=likes&expand[]=runtime`
|
| 142 |
);
|
| 143 |
data = await res.json();
|
| 144 |
console.log(data)
|
|
|
|
| 185 |
>
|
| 186 |
<section class="container px-6 grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-14 mx-auto relative">
|
| 187 |
<div class="col-span-2 lg:col-span-1 flex flex-col gap-14 row-start">
|
| 188 |
+
<h1 class="text-lg font-semibold text-gray-800 whitespace-nowrap">smolagents and tools gallery</h1>
|
| 189 |
</div>
|
| 190 |
<div class="col-span-2 md:col-span-3 flex items-center gap-14 flex flex-wrap lg-auto lg:ml-auto text-sm">
|
| 191 |
+
<div class="flex gap-2">
|
| 192 |
+
<span class="md:px-3 py-1 text-gray-800">type</span>
|
| 193 |
+
<button
|
| 194 |
+
:class="buttonClass('filter', 'tool')"
|
| 195 |
+
@click="filterType('tool')"
|
| 196 |
+
>
|
| 197 |
+
Tools
|
| 198 |
+
</button>
|
| 199 |
+
<button
|
| 200 |
+
:class="buttonClass('filter', 'agent')"
|
| 201 |
+
@click="filterType('agent')"
|
| 202 |
+
>
|
| 203 |
+
Agents
|
| 204 |
+
</button>
|
| 205 |
+
</div>
|
| 206 |
<div class="flex gap-2">
|
| 207 |
<span class="md:px-3 py-1 text-gray-800">sort by</span>
|
| 208 |
<button
|
| 209 |
+
:class="buttonClass('sort', 'likes')"
|
| 210 |
+
@click="sortThemes('likes')"
|
| 211 |
>
|
| 212 |
Most Likes
|
| 213 |
</button>
|
|
|
|
| 219 |
</button>
|
| 220 |
</div>
|
| 221 |
<div class="flex gap-0">
|
|
|
|
|
|
|
| 222 |
<input type="checkbox" @click="switchTheme()" class="rounded accent-orange-300">
|
| 223 |
<span class="md:px-3 py-1 text-gray-800 ml-0">Show Dark Mode</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
</div>
|
| 225 |
</div>
|
| 226 |
</section>
|
| 227 |
<div class="container px-6 grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2 mx-auto my-8 relative">
|
| 228 |
<template x-for="theme in themes" :key="theme.id">
|
| 229 |
<div class="grid-item">
|
| 230 |
+
<div class="grid-item-header">
|
| 231 |
+
<h2 class="text-sm font-medium text-white" x-text="theme.id"></h2>
|
| 232 |
+
</div>
|
| 233 |
<iframe :src="`${theme.subdomain}?_=${new Date().getTime()}&__theme=${mode}`" :alt="theme.id" scrolling="no" frameborder="0" loading="lazy"></iframe>
|
| 234 |
<a :href="`https://huggingface.co/spaces/${theme.id}`" target="_blank"></a>
|
| 235 |
</div>
|