cduss commited on
Commit
717de48
·
verified ·
1 Parent(s): af8590f

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +39 -49
index.html CHANGED
@@ -365,21 +365,30 @@
365
 
366
  async loadSpaces() {
367
  try {
368
- // First, try to get spaces by tag
369
- const response = await fetch(`https://huggingface.co/api/spaces?tags=${this.targetTag}&sort=likes&direction=-1&limit=100`);
 
 
370
 
371
  if (!response.ok) {
372
  throw new Error(`HTTP error! status: ${response.status}`);
373
  }
374
 
375
  const data = await response.json();
 
 
 
 
 
 
 
 
 
 
376
 
377
- // Filter spaces that actually have the reachy_mini tag
378
- const reachyMiniSpaces = data.filter(space =>
379
- space.tags && space.tags.includes(this.targetTag)
380
- );
381
 
382
- this.spaces = reachyMiniSpaces.map(space => ({
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
- // If no spaces found with tag, try alternative search
 
 
395
  if (this.spaces.length === 0) {
396
- await this.fallbackSearch();
 
397
  }
398
 
399
- this.filteredSpaces = [...this.spaces];
400
- this.updateStats();
401
  } catch (error) {
402
  console.error('Error loading spaces:', error);
403
- await this.fallbackSearch();
404
  }
405
  }
406
 
407
- async fallbackSearch() {
408
- try {
409
- console.log('Trying fallback search...');
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
- this.filteredSpaces = [...this.spaces];
440
- this.updateStats();
441
- } catch (error) {
442
- console.error('Fallback search also failed:', error);
443
- this.showError();
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() {