Update index.html
Browse files- index.html +39 -49
index.html
CHANGED
|
@@ -365,21 +365,30 @@
|
|
| 365 |
|
| 366 |
async loadSpaces() {
|
| 367 |
try {
|
| 368 |
-
|
| 369 |
-
|
|
|
|
|
|
|
| 370 |
|
| 371 |
if (!response.ok) {
|
| 372 |
throw new Error(`HTTP error! status: ${response.status}`);
|
| 373 |
}
|
| 374 |
|
| 375 |
const data = await response.json();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
|
| 377 |
-
|
| 378 |
-
const reachyMiniSpaces = data.filter(space =>
|
| 379 |
-
space.tags && space.tags.includes(this.targetTag)
|
| 380 |
-
);
|
| 381 |
|
| 382 |
-
this.spaces =
|
| 383 |
id: space.id,
|
| 384 |
title: space.id.split('/').pop().replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase()),
|
| 385 |
author: space.author,
|
|
@@ -391,57 +400,38 @@
|
|
| 391 |
downloads: space.downloads || 0
|
| 392 |
}));
|
| 393 |
|
| 394 |
-
|
|
|
|
|
|
|
| 395 |
if (this.spaces.length === 0) {
|
| 396 |
-
|
|
|
|
| 397 |
}
|
| 398 |
|
| 399 |
-
this.filteredSpaces = [...this.spaces];
|
| 400 |
-
this.updateStats();
|
| 401 |
} catch (error) {
|
| 402 |
console.error('Error loading spaces:', error);
|
| 403 |
-
|
| 404 |
}
|
| 405 |
}
|
| 406 |
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
// Fallback: search by text in case tag search doesn't work
|
| 411 |
-
const response = await fetch('https://huggingface.co/api/spaces?search=reachy&sort=likes&direction=-1&limit=100');
|
| 412 |
-
|
| 413 |
-
if (!response.ok) {
|
| 414 |
-
throw new Error(`HTTP error! status: ${response.status}`);
|
| 415 |
-
}
|
| 416 |
-
|
| 417 |
-
const data = await response.json();
|
| 418 |
-
|
| 419 |
-
// Filter for spaces that contain "reachy" or "mini" in name/description
|
| 420 |
-
const reachySpaces = data.filter(space => {
|
| 421 |
-
const name = space.id.toLowerCase();
|
| 422 |
-
const description = (space.cardData?.short_description || space.cardData?.description || '').toLowerCase();
|
| 423 |
-
return name.includes('reachy') || name.includes('mini') ||
|
| 424 |
-
description.includes('reachy') || description.includes('mini');
|
| 425 |
-
});
|
| 426 |
-
|
| 427 |
-
this.spaces = reachySpaces.map(space => ({
|
| 428 |
-
id: space.id,
|
| 429 |
-
title: space.id.split('/').pop().replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase()),
|
| 430 |
-
author: space.author,
|
| 431 |
-
description: space.cardData?.short_description || space.cardData?.description || 'No description available',
|
| 432 |
-
likes: space.likes || 0,
|
| 433 |
-
created: new Date(space.createdAt).getTime(),
|
| 434 |
-
url: `https://huggingface.co/spaces/${space.id}`,
|
| 435 |
-
tags: space.tags || [],
|
| 436 |
-
downloads: space.downloads || 0
|
| 437 |
-
}));
|
| 438 |
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 445 |
}
|
| 446 |
|
| 447 |
setupEventListeners() {
|
|
|
|
| 365 |
|
| 366 |
async loadSpaces() {
|
| 367 |
try {
|
| 368 |
+
console.log('Searching for spaces with exactly "reachy_mini" tag...');
|
| 369 |
+
|
| 370 |
+
// Use Hugging Face API to search for spaces with the exact tag
|
| 371 |
+
const response = await fetch(`https://huggingface.co/api/spaces?tags=${this.targetTag}&sort=likes&direction=-1&limit=200`);
|
| 372 |
|
| 373 |
if (!response.ok) {
|
| 374 |
throw new Error(`HTTP error! status: ${response.status}`);
|
| 375 |
}
|
| 376 |
|
| 377 |
const data = await response.json();
|
| 378 |
+
console.log('API response:', data.length, 'spaces found');
|
| 379 |
+
|
| 380 |
+
// Filter ONLY spaces that have exactly the "reachy_mini" tag
|
| 381 |
+
const exactTagSpaces = data.filter(space => {
|
| 382 |
+
const hasExactTag = space.tags && space.tags.includes(this.targetTag);
|
| 383 |
+
if (hasExactTag) {
|
| 384 |
+
console.log('Found space with reachy_mini tag:', space.id, 'tags:', space.tags);
|
| 385 |
+
}
|
| 386 |
+
return hasExactTag;
|
| 387 |
+
});
|
| 388 |
|
| 389 |
+
console.log('Spaces with exact reachy_mini tag:', exactTagSpaces.length);
|
|
|
|
|
|
|
|
|
|
| 390 |
|
| 391 |
+
this.spaces = exactTagSpaces.map(space => ({
|
| 392 |
id: space.id,
|
| 393 |
title: space.id.split('/').pop().replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase()),
|
| 394 |
author: space.author,
|
|
|
|
| 400 |
downloads: space.downloads || 0
|
| 401 |
}));
|
| 402 |
|
| 403 |
+
this.filteredSpaces = [...this.spaces];
|
| 404 |
+
this.updateStats();
|
| 405 |
+
|
| 406 |
if (this.spaces.length === 0) {
|
| 407 |
+
console.log('No spaces with reachy_mini tag found');
|
| 408 |
+
this.showNoResults();
|
| 409 |
}
|
| 410 |
|
|
|
|
|
|
|
| 411 |
} catch (error) {
|
| 412 |
console.error('Error loading spaces:', error);
|
| 413 |
+
this.showError();
|
| 414 |
}
|
| 415 |
}
|
| 416 |
|
| 417 |
+
showNoResults() {
|
| 418 |
+
const grid = document.getElementById('spacesGrid');
|
| 419 |
+
const stats = document.getElementById('stats');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 420 |
|
| 421 |
+
stats.innerHTML = 'No spaces found with reachy_mini tag';
|
| 422 |
+
grid.innerHTML = `
|
| 423 |
+
<div class="no-results">
|
| 424 |
+
<h3>🔍 No Reachy Mini Spaces Found</h3>
|
| 425 |
+
<p>No spaces were found with the "reachy_mini" tag or related variants.</p>
|
| 426 |
+
<p>This could mean:</p>
|
| 427 |
+
<ul style="text-align: left; margin-top: 15px; display: inline-block;">
|
| 428 |
+
<li>No spaces have been tagged with "reachy_mini" yet</li>
|
| 429 |
+
<li>The spaces might use different tag variations</li>
|
| 430 |
+
<li>The API might have restrictions or rate limits</li>
|
| 431 |
+
</ul>
|
| 432 |
+
<p style="margin-top: 15px;">Try checking Hugging Face Spaces directly for the most up-to-date results.</p>
|
| 433 |
+
</div>
|
| 434 |
+
`;
|
| 435 |
}
|
| 436 |
|
| 437 |
setupEventListeners() {
|