Update index.html
Browse files- index.html +61 -61
index.html
CHANGED
|
@@ -368,14 +368,14 @@
|
|
| 368 |
|
| 369 |
<!-- Replicate Section -->
|
| 370 |
<div id="replicate" class="content-section">
|
| 371 |
-
<div class="
|
| 372 |
-
<
|
| 373 |
-
<
|
| 374 |
</div>
|
| 375 |
<div id="replicate-content" class="items-grid">
|
| 376 |
<div class="loading">
|
| 377 |
<div class="loading-spinner"></div>
|
| 378 |
-
<p>Loading models...</p>
|
| 379 |
</div>
|
| 380 |
</div>
|
| 381 |
</div>
|
|
@@ -405,7 +405,7 @@
|
|
| 405 |
} else if (category === 'hf-spaces') {
|
| 406 |
loadHFSpaces();
|
| 407 |
} else if (category === 'replicate') {
|
| 408 |
-
loadReplicate(
|
| 409 |
}
|
| 410 |
}
|
| 411 |
|
|
@@ -415,7 +415,7 @@
|
|
| 415 |
container.innerHTML = '<div class="loading"><div class="loading-spinner"></div><p>Loading trending models...</p></div>';
|
| 416 |
|
| 417 |
try {
|
| 418 |
-
const response = await fetch('https://huggingface.co/api/models?sort=likes7d&direction=-1&limit=
|
| 419 |
const data = await response.json();
|
| 420 |
displayHFModels(data, container);
|
| 421 |
} catch (error) {
|
|
@@ -429,7 +429,7 @@
|
|
| 429 |
container.innerHTML = '<div class="loading"><div class="loading-spinner"></div><p>Loading trending spaces...</p></div>';
|
| 430 |
|
| 431 |
try {
|
| 432 |
-
const response = await fetch('https://huggingface.co/api/spaces?sort=likes7d&direction=-1&limit=
|
| 433 |
const data = await response.json();
|
| 434 |
displayHFSpaces(data, container);
|
| 435 |
} catch (error) {
|
|
@@ -438,32 +438,49 @@
|
|
| 438 |
}
|
| 439 |
|
| 440 |
// Replicate ๋ชจ๋ธ ๋ก๋
|
| 441 |
-
async function loadReplicate(
|
| 442 |
-
const currentType = type || 'featured';
|
| 443 |
-
|
| 444 |
-
document.querySelectorAll('#replicate .filter-btn').forEach(btn => {
|
| 445 |
-
btn.classList.remove('active');
|
| 446 |
-
});
|
| 447 |
-
if (event && event.target) {
|
| 448 |
-
event.target.classList.add('active');
|
| 449 |
-
} else {
|
| 450 |
-
document.querySelector('#replicate .filter-btn').classList.add('active');
|
| 451 |
-
}
|
| 452 |
-
|
| 453 |
const container = document.getElementById('replicate-content');
|
| 454 |
-
container.innerHTML = '<div class="loading"><div class="loading-spinner"></div><p>Loading models...</p></div>';
|
| 455 |
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 467 |
const scriptTags = doc.querySelectorAll('script');
|
| 468 |
let modelsData = [];
|
| 469 |
|
|
@@ -484,15 +501,13 @@
|
|
| 484 |
}
|
| 485 |
|
| 486 |
if (modelsData.length > 0) {
|
| 487 |
-
displayReplicateModels(modelsData, container
|
| 488 |
} else {
|
| 489 |
-
displaySampleReplicateModels(container
|
| 490 |
}
|
| 491 |
-
} catch (error) {
|
| 492 |
-
displaySampleReplicateModels(container, currentType);
|
| 493 |
}
|
| 494 |
-
}
|
| 495 |
-
displaySampleReplicateModels(container
|
| 496 |
}
|
| 497 |
}
|
| 498 |
|
|
@@ -501,8 +516,8 @@
|
|
| 501 |
try {
|
| 502 |
const proxyUrl = 'https://api.allorigins.win/raw?url=';
|
| 503 |
const targetUrl = type === 'models'
|
| 504 |
-
? 'https://huggingface.co/api/models?sort=likes7d&direction=-1&limit=
|
| 505 |
-
: 'https://huggingface.co/api/spaces?sort=likes7d&direction=-1&limit=
|
| 506 |
|
| 507 |
const response = await fetch(proxyUrl + encodeURIComponent(targetUrl));
|
| 508 |
const data = await response.json();
|
|
@@ -560,17 +575,17 @@
|
|
| 560 |
}
|
| 561 |
|
| 562 |
// Replicate ์ค์๊ฐ ๋ชจ๋ธ ํ์
|
| 563 |
-
function displayReplicateModels(models, container
|
| 564 |
container.innerHTML = '';
|
| 565 |
models.forEach((model, index) => {
|
| 566 |
const card = createModelCard({
|
| 567 |
rank: index + 1,
|
| 568 |
title: model.name || model.default_example?.model || 'Unknown',
|
| 569 |
-
author: model.owner || model.username || 'replicate',
|
| 570 |
runs: model.run_count || model.runs || 0,
|
| 571 |
icon: getModelIcon(model.name),
|
| 572 |
-
badge:
|
| 573 |
-
url: model.url || `https://replicate.com/${model.owner || 'p'}/${model.name}`
|
| 574 |
});
|
| 575 |
container.appendChild(card);
|
| 576 |
});
|
|
@@ -679,18 +694,7 @@
|
|
| 679 |
});
|
| 680 |
}
|
| 681 |
|
| 682 |
-
function displaySampleReplicateModels(container
|
| 683 |
-
const featuredData = [
|
| 684 |
-
{ rank: 1, title: 'flux-1.1-pro', author: 'black-forest-labs', runs: 2910000, icon: '๐จ', badge: 'โญ Featured' },
|
| 685 |
-
{ rank: 2, title: 'llama-3.3-70b-versatile', author: 'meta', runs: 1850000, icon: '๐ค', badge: 'โญ Featured' },
|
| 686 |
-
{ rank: 3, title: 'stable-video-diffusion', author: 'stability-ai', runs: 890000, icon: '๐ฌ', badge: 'โญ Featured' },
|
| 687 |
-
{ rank: 4, title: 'whisper-large-v3-turbo', author: 'openai', runs: 670000, icon: '๐ค', badge: 'โญ Featured' },
|
| 688 |
-
{ rank: 5, title: 'musicgen-stereo-large', author: 'facebook', runs: 450000, icon: '๐ต', badge: 'โญ Featured' },
|
| 689 |
-
{ rank: 6, title: 'animate-lcm', author: 'lucataco', runs: 320000, icon: 'โจ', badge: 'โญ Featured' },
|
| 690 |
-
{ rank: 7, title: 'instant-id', author: 'zsxkib', runs: 280000, icon: '๐ค', badge: 'โญ Featured' },
|
| 691 |
-
{ rank: 8, title: 'face-restoration', author: 'tencentarc', runs: 210000, icon: 'โจ', badge: 'โญ Featured' }
|
| 692 |
-
];
|
| 693 |
-
|
| 694 |
const officialData = [
|
| 695 |
{ rank: 1, title: 'meta-llama-3.3-70b-instruct', author: 'meta', runs: 3450000, icon: '๐ค', badge: 'โ
Official' },
|
| 696 |
{ rank: 2, title: 'flux-1.1-pro', author: 'black-forest-labs', runs: 2910000, icon: '๐จ', badge: 'โ
Official' },
|
|
@@ -702,10 +706,8 @@
|
|
| 702 |
{ rank: 8, title: 'gemma-2-9b-it', author: 'google', runs: 180000, icon: '๐ฌ', badge: 'โ
Official' }
|
| 703 |
];
|
| 704 |
|
| 705 |
-
const sampleData = type === 'official' ? officialData : featuredData;
|
| 706 |
-
|
| 707 |
container.innerHTML = '';
|
| 708 |
-
|
| 709 |
model.url = `https://replicate.com/${model.author}/${model.title}`;
|
| 710 |
container.appendChild(createModelCard(model));
|
| 711 |
});
|
|
@@ -718,9 +720,7 @@
|
|
| 718 |
} else if (currentCategory === 'hf-spaces') {
|
| 719 |
loadHFSpaces();
|
| 720 |
} else {
|
| 721 |
-
|
| 722 |
-
const type = activeBtn.textContent.includes('Featured') ? 'featured' : 'official';
|
| 723 |
-
loadReplicate(type);
|
| 724 |
}
|
| 725 |
}
|
| 726 |
|
|
|
|
| 368 |
|
| 369 |
<!-- Replicate Section -->
|
| 370 |
<div id="replicate" class="content-section">
|
| 371 |
+
<div class="section-header">
|
| 372 |
+
<h2>โ
Official Collection</h2>
|
| 373 |
+
<p style="color: #7f8c8d; margin-top: 5px;">from replicate.com/collections/official</p>
|
| 374 |
</div>
|
| 375 |
<div id="replicate-content" class="items-grid">
|
| 376 |
<div class="loading">
|
| 377 |
<div class="loading-spinner"></div>
|
| 378 |
+
<p>Loading official models...</p>
|
| 379 |
</div>
|
| 380 |
</div>
|
| 381 |
</div>
|
|
|
|
| 405 |
} else if (category === 'hf-spaces') {
|
| 406 |
loadHFSpaces();
|
| 407 |
} else if (category === 'replicate') {
|
| 408 |
+
loadReplicate();
|
| 409 |
}
|
| 410 |
}
|
| 411 |
|
|
|
|
| 415 |
container.innerHTML = '<div class="loading"><div class="loading-spinner"></div><p>Loading trending models...</p></div>';
|
| 416 |
|
| 417 |
try {
|
| 418 |
+
const response = await fetch('https://huggingface.co/api/models?sort=likes7d&direction=-1&limit=100');
|
| 419 |
const data = await response.json();
|
| 420 |
displayHFModels(data, container);
|
| 421 |
} catch (error) {
|
|
|
|
| 429 |
container.innerHTML = '<div class="loading"><div class="loading-spinner"></div><p>Loading trending spaces...</p></div>';
|
| 430 |
|
| 431 |
try {
|
| 432 |
+
const response = await fetch('https://huggingface.co/api/spaces?sort=likes7d&direction=-1&limit=100');
|
| 433 |
const data = await response.json();
|
| 434 |
displayHFSpaces(data, container);
|
| 435 |
} catch (error) {
|
|
|
|
| 438 |
}
|
| 439 |
|
| 440 |
// Replicate ๋ชจ๋ธ ๋ก๋
|
| 441 |
+
async function loadReplicate() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 442 |
const container = document.getElementById('replicate-content');
|
| 443 |
+
container.innerHTML = '<div class="loading"><div class="loading-spinner"></div><p>Loading official models...</p></div>';
|
| 444 |
|
| 445 |
+
try {
|
| 446 |
+
const proxyUrl = 'https://api.allorigins.win/raw?url=';
|
| 447 |
+
const targetUrl = 'https://replicate.com/collections/official';
|
| 448 |
+
|
| 449 |
+
const response = await fetch(proxyUrl + encodeURIComponent(targetUrl));
|
| 450 |
+
const html = await response.text();
|
| 451 |
+
|
| 452 |
+
// HTML์์ ๋ชจ๋ธ URL ์ถ์ถ
|
| 453 |
+
const parser = new DOMParser();
|
| 454 |
+
const doc = parser.parseFromString(html, 'text/html');
|
| 455 |
+
|
| 456 |
+
// ๋ชจ๋ ๋ชจ๋ธ ๋งํฌ ์ฐพ๊ธฐ
|
| 457 |
+
const modelLinks = doc.querySelectorAll('a[href*="/models/"], a[href*="/p/"]');
|
| 458 |
+
const models = [];
|
| 459 |
+
const seenUrls = new Set();
|
| 460 |
+
|
| 461 |
+
modelLinks.forEach(link => {
|
| 462 |
+
const href = link.getAttribute('href');
|
| 463 |
+
if (href && !seenUrls.has(href)) {
|
| 464 |
+
seenUrls.add(href);
|
| 465 |
+
const parts = href.split('/');
|
| 466 |
+
if (parts.length >= 3) {
|
| 467 |
+
const author = parts[parts.length - 2];
|
| 468 |
+
const name = parts[parts.length - 1];
|
| 469 |
+
if (author && name && author !== 'models' && author !== 'p') {
|
| 470 |
+
models.push({
|
| 471 |
+
author: author,
|
| 472 |
+
name: name,
|
| 473 |
+
url: `https://replicate.com${href}`
|
| 474 |
+
});
|
| 475 |
+
}
|
| 476 |
+
}
|
| 477 |
+
}
|
| 478 |
+
});
|
| 479 |
+
|
| 480 |
+
if (models.length > 0) {
|
| 481 |
+
displayReplicateModels(models, container);
|
| 482 |
+
} else {
|
| 483 |
+
// Fallback: JSON ๋ฐ์ดํฐ ์ถ์ถ ์๋
|
| 484 |
const scriptTags = doc.querySelectorAll('script');
|
| 485 |
let modelsData = [];
|
| 486 |
|
|
|
|
| 501 |
}
|
| 502 |
|
| 503 |
if (modelsData.length > 0) {
|
| 504 |
+
displayReplicateModels(modelsData, container);
|
| 505 |
} else {
|
| 506 |
+
displaySampleReplicateModels(container);
|
| 507 |
}
|
|
|
|
|
|
|
| 508 |
}
|
| 509 |
+
} catch (error) {
|
| 510 |
+
displaySampleReplicateModels(container);
|
| 511 |
}
|
| 512 |
}
|
| 513 |
|
|
|
|
| 516 |
try {
|
| 517 |
const proxyUrl = 'https://api.allorigins.win/raw?url=';
|
| 518 |
const targetUrl = type === 'models'
|
| 519 |
+
? 'https://huggingface.co/api/models?sort=likes7d&direction=-1&limit=100'
|
| 520 |
+
: 'https://huggingface.co/api/spaces?sort=likes7d&direction=-1&limit=100';
|
| 521 |
|
| 522 |
const response = await fetch(proxyUrl + encodeURIComponent(targetUrl));
|
| 523 |
const data = await response.json();
|
|
|
|
| 575 |
}
|
| 576 |
|
| 577 |
// Replicate ์ค์๊ฐ ๋ชจ๋ธ ํ์
|
| 578 |
+
function displayReplicateModels(models, container) {
|
| 579 |
container.innerHTML = '';
|
| 580 |
models.forEach((model, index) => {
|
| 581 |
const card = createModelCard({
|
| 582 |
rank: index + 1,
|
| 583 |
title: model.name || model.default_example?.model || 'Unknown',
|
| 584 |
+
author: model.owner || model.author || model.username || 'replicate',
|
| 585 |
runs: model.run_count || model.runs || 0,
|
| 586 |
icon: getModelIcon(model.name),
|
| 587 |
+
badge: 'โ
Official',
|
| 588 |
+
url: model.url || `https://replicate.com/${model.owner || model.author || 'p'}/${model.name}`
|
| 589 |
});
|
| 590 |
container.appendChild(card);
|
| 591 |
});
|
|
|
|
| 694 |
});
|
| 695 |
}
|
| 696 |
|
| 697 |
+
function displaySampleReplicateModels(container) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 698 |
const officialData = [
|
| 699 |
{ rank: 1, title: 'meta-llama-3.3-70b-instruct', author: 'meta', runs: 3450000, icon: '๐ค', badge: 'โ
Official' },
|
| 700 |
{ rank: 2, title: 'flux-1.1-pro', author: 'black-forest-labs', runs: 2910000, icon: '๐จ', badge: 'โ
Official' },
|
|
|
|
| 706 |
{ rank: 8, title: 'gemma-2-9b-it', author: 'google', runs: 180000, icon: '๐ฌ', badge: 'โ
Official' }
|
| 707 |
];
|
| 708 |
|
|
|
|
|
|
|
| 709 |
container.innerHTML = '';
|
| 710 |
+
officialData.forEach(model => {
|
| 711 |
model.url = `https://replicate.com/${model.author}/${model.title}`;
|
| 712 |
container.appendChild(createModelCard(model));
|
| 713 |
});
|
|
|
|
| 720 |
} else if (currentCategory === 'hf-spaces') {
|
| 721 |
loadHFSpaces();
|
| 722 |
} else {
|
| 723 |
+
loadReplicate();
|
|
|
|
|
|
|
| 724 |
}
|
| 725 |
}
|
| 726 |
|