Commit
·
f1f0d98
1
Parent(s):
661e2b4
Enhance UI and search functionality with improved styling and API query
Browse files- index.html +31 -12
index.html
CHANGED
|
@@ -35,7 +35,7 @@
|
|
| 35 |
width: 100%;
|
| 36 |
height: 600px;
|
| 37 |
pointer-events: none;
|
| 38 |
-
margin-top:
|
| 39 |
}
|
| 40 |
|
| 41 |
.grid-container {
|
|
@@ -70,12 +70,26 @@
|
|
| 70 |
top: 0;
|
| 71 |
left: 0;
|
| 72 |
right: 0;
|
| 73 |
-
height:
|
| 74 |
-
background: rgba(0,0,0,0.
|
| 75 |
-
padding: 8px;
|
| 76 |
z-index: 10;
|
| 77 |
display: flex;
|
| 78 |
align-items: center;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
}
|
| 80 |
</style>
|
| 81 |
|
|
@@ -140,12 +154,17 @@
|
|
| 140 |
data = await res.json();
|
| 141 |
} else {
|
| 142 |
const searchFilters = this.filter === 'tool' ? 'tool' : '(smolagent OR agent OR smolagents)';
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
data = await res.json();
|
| 150 |
console.log(data)
|
| 151 |
// Transform the API response to match the expected format
|
|
@@ -192,8 +211,8 @@
|
|
| 192 |
<section class="container px-6 grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-14 mx-auto relative">
|
| 193 |
<div class="col-span-2 lg:col-span-1 flex flex-col gap-14 row-start">
|
| 194 |
<div class="flex items-center gap-2">
|
| 195 |
-
<img src="https://camo.githubusercontent.com/a8c1f1d12aa3114010c6e74b29d47fee91d8da10a915f065c38e6d0ea7f16568/68747470733a2f2f68756767696e67666163652e636f2f64617461736574732f68756767696e67666163652f646f63756d656e746174696f6e2d696d616765732f7265736f6c76652f6d61696e2f736d6f6c6167656e74732f6d6173636f742e706e67" alt="Smolagents mascot" class="w-14 h-14">
|
| 196 |
-
<h1 class="text-xl font-semibold text-gray-800
|
| 197 |
</div>
|
| 198 |
</div>
|
| 199 |
<div class="col-span-2 md:col-span-3 flex items-center gap-14 flex flex-wrap lg-auto lg:ml-auto text-sm">
|
|
|
|
| 35 |
width: 100%;
|
| 36 |
height: 600px;
|
| 37 |
pointer-events: none;
|
| 38 |
+
margin-top: 48px; /* Match header height */
|
| 39 |
}
|
| 40 |
|
| 41 |
.grid-container {
|
|
|
|
| 70 |
top: 0;
|
| 71 |
left: 0;
|
| 72 |
right: 0;
|
| 73 |
+
height: 48px;
|
| 74 |
+
background: rgba(0,0,0,0.75);
|
| 75 |
+
padding: 8px 16px;
|
| 76 |
z-index: 10;
|
| 77 |
display: flex;
|
| 78 |
align-items: center;
|
| 79 |
+
width: 100%;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
.grid-item-header h2 {
|
| 83 |
+
width: 100%;
|
| 84 |
+
overflow-wrap: break-word;
|
| 85 |
+
word-wrap: break-word;
|
| 86 |
+
hyphens: auto;
|
| 87 |
+
max-height: 32px;
|
| 88 |
+
overflow: hidden;
|
| 89 |
+
display: -webkit-box;
|
| 90 |
+
-webkit-line-clamp: 2;
|
| 91 |
+
-webkit-box-orient: vertical;
|
| 92 |
+
line-height: 1.2;
|
| 93 |
}
|
| 94 |
</style>
|
| 95 |
|
|
|
|
| 154 |
data = await res.json();
|
| 155 |
} else {
|
| 156 |
const searchFilters = this.filter === 'tool' ? 'tool' : '(smolagent OR agent OR smolagents)';
|
| 157 |
+
let searchUrl;
|
| 158 |
+
if (this.searchQuery) {
|
| 159 |
+
if (this.searchType === 'semantic') {
|
| 160 |
+
searchUrl = `https://huggingface.co/api/spaces/semantic-search?q=${encodeURIComponent(this.searchQuery)}`;
|
| 161 |
+
} else {
|
| 162 |
+
searchUrl = `https://huggingface.co/api/spaces?limit=500&filter=${searchFilters}&search=${encodeURIComponent(this.searchQuery)}&expand[]=subdomain&expand[]=lastModified&expand[]=likes&expand[]=runtime`;
|
| 163 |
+
}
|
| 164 |
+
} else {
|
| 165 |
+
searchUrl = `https://huggingface.co/api/spaces?limit=500&filter=${encodeURIComponent(searchFilters)}&expand[]=subdomain&expand[]=lastModified&expand[]=likes&expand[]=runtime`;
|
| 166 |
+
}
|
| 167 |
+
const res = await fetch(searchUrl);
|
| 168 |
data = await res.json();
|
| 169 |
console.log(data)
|
| 170 |
// Transform the API response to match the expected format
|
|
|
|
| 211 |
<section class="container px-6 grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-14 mx-auto relative">
|
| 212 |
<div class="col-span-2 lg:col-span-1 flex flex-col gap-14 row-start">
|
| 213 |
<div class="flex items-center gap-2">
|
| 214 |
+
<img src="https://camo.githubusercontent.com/a8c1f1d12aa3114010c6e74b29d47fee91d8da10a915f065c38e6d0ea7f16568/68747470733a2f2f68756767696e67666163652e636f2f64617461736574732f68756767696e67666163652f646f63756d656e746174696f6e2d696d616765732f7265736f6c76652f6d61696e2f736d6f6c6167656e74732f6d6173636f742e706e67" alt="Smolagents mascot" class="w-14 h-14 flex-shrink-0">
|
| 215 |
+
<h1 class="text-xl font-semibold text-gray-800 break-words">smolagents and tools gallery</h1>
|
| 216 |
</div>
|
| 217 |
</div>
|
| 218 |
<div class="col-span-2 md:col-span-3 flex items-center gap-14 flex flex-wrap lg-auto lg:ml-auto text-sm">
|