Update index.html
Browse files- index.html +565 -43
index.html
CHANGED
@@ -90,6 +90,150 @@
|
|
90 |
margin-bottom: 10px;
|
91 |
}
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
.filter-buttons {
|
94 |
display: flex;
|
95 |
gap: 15px;
|
@@ -345,6 +489,28 @@
|
|
345 |
<div class="section-header">
|
346 |
<h2>๐ Trending Models</h2>
|
347 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
<div id="hf-models-content" class="items-grid">
|
349 |
<div class="loading">
|
350 |
<div class="loading-spinner"></div>
|
@@ -358,6 +524,26 @@
|
|
358 |
<div class="section-header">
|
359 |
<h2>๐ฏ Trending Spaces</h2>
|
360 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
<div id="hf-spaces-content" class="items-grid">
|
362 |
<div class="loading">
|
363 |
<div class="loading-spinner"></div>
|
@@ -372,6 +558,14 @@
|
|
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>
|
@@ -385,6 +579,13 @@
|
|
385 |
|
386 |
<script>
|
387 |
let currentCategory = 'hf-models';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
|
389 |
// Replicate URL ๋ฆฌ์คํธ
|
390 |
const replicateUrls = [
|
@@ -544,10 +745,9 @@
|
|
544 |
// Replicate ๋ชจ๋ธ ๋ก๋
|
545 |
function loadReplicate() {
|
546 |
const container = document.getElementById('replicate-content');
|
547 |
-
container.innerHTML = '';
|
548 |
|
549 |
// URL์์ ๋ชจ๋ธ ์ ๋ณด ์ถ์ถ
|
550 |
-
|
551 |
const parts = url.split('/');
|
552 |
const author = parts[parts.length - 2];
|
553 |
const modelName = parts[parts.length - 1];
|
@@ -562,11 +762,9 @@
|
|
562 |
};
|
563 |
});
|
564 |
|
565 |
-
//
|
566 |
-
|
567 |
-
|
568 |
-
container.appendChild(card);
|
569 |
-
});
|
570 |
}
|
571 |
|
572 |
// ํ๋ก์ ์์ฒญ
|
@@ -596,8 +794,8 @@
|
|
596 |
|
597 |
// HuggingFace Models ํ์
|
598 |
function displayHFModels(models, container) {
|
599 |
-
|
600 |
-
models.
|
601 |
// ์์ฑ์ผ์ ํ์ธ (1์ฃผ์ผ ์ด๋ด์ธ์ง)
|
602 |
let isNew = false;
|
603 |
if (model.createdAt) {
|
@@ -607,7 +805,7 @@
|
|
607 |
isNew = createdDate > oneWeekAgo;
|
608 |
}
|
609 |
|
610 |
-
|
611 |
rank: index + 1,
|
612 |
title: model.id?.split('/')[1] || model.modelId || 'Unknown',
|
613 |
author: model.id?.split('/')[0] || model.author || 'Unknown',
|
@@ -617,16 +815,20 @@
|
|
617 |
pipeline_tag: model.pipeline_tag || '',
|
618 |
url: `https://huggingface.co/${model.id || model.modelId}`,
|
619 |
icon: '๐ค',
|
620 |
-
badge: isNew ? '๐ New' : null
|
621 |
-
|
622 |
-
|
623 |
});
|
|
|
|
|
|
|
|
|
624 |
}
|
625 |
|
626 |
// HuggingFace Spaces ํ์
|
627 |
function displayHFSpaces(spaces, container) {
|
628 |
-
|
629 |
-
spaces.
|
630 |
// ์์ฑ์ผ์ ํ์ธ (1์ฃผ์ผ ์ด๋ด์ธ์ง)
|
631 |
let isNew = false;
|
632 |
if (space.createdAt) {
|
@@ -636,7 +838,7 @@
|
|
636 |
isNew = createdDate > oneWeekAgo;
|
637 |
}
|
638 |
|
639 |
-
|
640 |
rank: index + 1,
|
641 |
title: space.id?.split('/')[1] || 'Unknown',
|
642 |
author: space.id?.split('/')[0] || 'Unknown',
|
@@ -645,10 +847,14 @@
|
|
645 |
emoji: space.emoji || '๐ฏ',
|
646 |
url: `https://huggingface.co/spaces/${space.id}`,
|
647 |
icon: space.emoji || '๐ฏ',
|
648 |
-
badge: isNew ? '๐ New' : null
|
649 |
-
|
650 |
-
|
651 |
});
|
|
|
|
|
|
|
|
|
652 |
}
|
653 |
|
654 |
// ๋ชจ๋ธ ์นด๋ ์์ฑ
|
@@ -717,44 +923,44 @@
|
|
717 |
// ์ํ ๋ฐ์ดํฐ ํ์ ํจ์๋ค
|
718 |
function displaySampleHFModels(container) {
|
719 |
const sampleData = [
|
720 |
-
{ rank: 1, title: 'Llama-3.3-70B-Instruct', author: 'meta-llama', likes: 177000, downloads: 1150000, icon: '๐ค', pipeline_tag: 'text-generation', tags: ['llama', '70b', 'instruct'] },
|
721 |
-
{ rank: 2, title: 'DeepSeek-R1-Distill-Qwen-32B', author: 'deepseek-ai', likes: 10400, downloads: 567000, icon: '๐ค', pipeline_tag: 'text-generation', tags: ['deepseek', 'reasoning'], badge: '๐ New' },
|
722 |
-
{ rank: 3, title: 'Qwen3-235B-A22B', author: 'Qwen', likes: 5370, downloads: 225000, icon: '๐ค', pipeline_tag: 'text-generation', tags: ['qwen', 'large'], badge: '๐ New' },
|
723 |
-
{ rank: 4, title: 'FLUX.1-dev', author: 'black-forest-labs', likes: 29100, downloads: 397000, icon: '๐ค', pipeline_tag: 'text-to-image', tags: ['flux', 'diffusion'] },
|
724 |
-
{ rank: 5, title: 'Phi-4', author: 'microsoft', likes: 8900, downloads: 156000, icon: '๐ค', pipeline_tag: 'text-generation', tags: ['phi', 'small'], badge: '๐ New' },
|
725 |
-
{ rank: 6, title: 'stable-diffusion-3.5-large', author: 'stabilityai', likes: 7650, downloads: 234000, icon: '๐ค', pipeline_tag: 'text-to-image', tags: ['sd3', 'large'] },
|
726 |
-
{ rank: 7, title: 'whisper-large-v3-turbo', author: 'openai', likes: 6780, downloads: 189000, icon: '๐ค', pipeline_tag: 'automatic-speech-recognition', tags: ['whisper', 'asr'] },
|
727 |
-
{ rank: 8, title: 'MusicGen-Stereo-Melody', author: 'facebook', likes: 5430, downloads: 98000, icon: '๐ค', pipeline_tag: 'text-to-audio', tags: ['music', 'generation'] },
|
728 |
-
{ rank: 9, title: 'Florence-2-large', author: 'microsoft', likes: 4890, downloads: 87000, icon: '๐ค', pipeline_tag: 'image-text-to-text', tags: ['vision', 'florence'] },
|
729 |
-
{ rank: 10, title: 'QwQ-32B-Preview', author: 'Qwen', likes: 4560, downloads: 76000, icon: '๐ค', pipeline_tag: 'text-generation', tags: ['reasoning', 'cot'], badge: '๐ New' }
|
730 |
];
|
731 |
|
732 |
-
container.innerHTML = '';
|
733 |
sampleData.forEach(model => {
|
734 |
model.url = `https://huggingface.co/${model.author}/${model.title}`;
|
735 |
-
container.appendChild(createModelCard(model));
|
736 |
});
|
|
|
|
|
737 |
}
|
738 |
|
739 |
function displaySampleHFSpaces(container) {
|
740 |
const sampleData = [
|
741 |
-
{ rank: 1, title: 'stable-diffusion-webui', author: 'stabilityai', likes: 75500, sdk: 'Gradio', icon: '๐จ' },
|
742 |
-
{ rank: 2, title: 'chatgpt-clone', author: 'community', likes: 12300, sdk: 'Streamlit', icon: '๐ฌ', badge: '๐ New' },
|
743 |
-
{ rank: 3, title: 'InstantID', author: 'InstantX', likes: 8590, sdk: 'Gradio', icon: '๐ค' },
|
744 |
-
{ rank: 4, title: 'voice-clone-xtts', author: 'coqui', likes: 5640, sdk: 'Gradio', icon: '๐ค', badge: '๐ New' },
|
745 |
-
{ rank: 5, title: 'code-llama-playground', author: 'meta', likes: 3210, sdk: 'Gradio', icon: '๐ป' },
|
746 |
-
{ rank: 6, title: 'image-to-3d-model', author: '3d-ai', likes: 2890, sdk: 'Gradio', icon: '๐ฒ' },
|
747 |
-
{ rank: 7, title: 'music-visualizer', author: 'audio-viz', likes: 2340, sdk: 'Streamlit', icon: '๐ต', badge: '๐ New' },
|
748 |
-
{ rank: 8, title: 'pdf-chatbot', author: 'doc-ai', likes: 1980, sdk: 'Gradio', icon: '๐' },
|
749 |
-
{ rank: 9, title: 'anime-art-generator', author: 'waifu-ai', likes: 1670, sdk: 'Gradio', icon: '๐' },
|
750 |
-
{ rank: 10, title: 'dataset-explorer', author: 'data-tools', likes: 1450, sdk: 'Streamlit', icon: '๐' }
|
751 |
];
|
752 |
|
753 |
-
container.innerHTML = '';
|
754 |
sampleData.forEach(space => {
|
755 |
space.url = `https://huggingface.co/spaces/${space.author}/${space.title}`;
|
756 |
-
container.appendChild(createModelCard(space));
|
757 |
});
|
|
|
|
|
758 |
}
|
759 |
|
760 |
// ์๋ก๊ณ ์นจ
|
@@ -768,8 +974,324 @@
|
|
768 |
}
|
769 |
}
|
770 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
771 |
// ์ด๊ธฐ ๋ก๋
|
772 |
window.addEventListener('DOMContentLoaded', () => {
|
|
|
773 |
loadHFModels();
|
774 |
});
|
775 |
</script>
|
|
|
90 |
margin-bottom: 10px;
|
91 |
}
|
92 |
|
93 |
+
.search-container {
|
94 |
+
display: flex;
|
95 |
+
gap: 15px;
|
96 |
+
margin: 20px auto 30px;
|
97 |
+
max-width: 800px;
|
98 |
+
flex-wrap: wrap;
|
99 |
+
justify-content: center;
|
100 |
+
}
|
101 |
+
|
102 |
+
.search-input-wrapper {
|
103 |
+
position: relative;
|
104 |
+
flex: 1;
|
105 |
+
min-width: 300px;
|
106 |
+
}
|
107 |
+
|
108 |
+
.search-input {
|
109 |
+
width: 100%;
|
110 |
+
padding: 12px 45px 12px 20px;
|
111 |
+
border: 2px solid #e0e0e0;
|
112 |
+
border-radius: 25px;
|
113 |
+
font-size: 1rem;
|
114 |
+
transition: all 0.3s ease;
|
115 |
+
background: rgba(255, 255, 255, 0.9);
|
116 |
+
backdrop-filter: blur(10px);
|
117 |
+
}
|
118 |
+
|
119 |
+
.search-input:focus {
|
120 |
+
outline: none;
|
121 |
+
border-color: #667eea;
|
122 |
+
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
123 |
+
}
|
124 |
+
|
125 |
+
.search-icon {
|
126 |
+
position: absolute;
|
127 |
+
right: 20px;
|
128 |
+
top: 50%;
|
129 |
+
transform: translateY(-50%);
|
130 |
+
color: #999;
|
131 |
+
pointer-events: none;
|
132 |
+
}
|
133 |
+
|
134 |
+
.filter-select {
|
135 |
+
padding: 12px 20px;
|
136 |
+
border: 2px solid #e0e0e0;
|
137 |
+
border-radius: 25px;
|
138 |
+
font-size: 1rem;
|
139 |
+
background: rgba(255, 255, 255, 0.9);
|
140 |
+
backdrop-filter: blur(10px);
|
141 |
+
cursor: pointer;
|
142 |
+
transition: all 0.3s ease;
|
143 |
+
min-width: 150px;
|
144 |
+
}
|
145 |
+
|
146 |
+
.filter-select:focus {
|
147 |
+
outline: none;
|
148 |
+
border-color: #667eea;
|
149 |
+
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
150 |
+
}
|
151 |
+
|
152 |
+
.search-suggestions {
|
153 |
+
position: absolute;
|
154 |
+
top: 100%;
|
155 |
+
left: 0;
|
156 |
+
right: 0;
|
157 |
+
background: white;
|
158 |
+
border-radius: 15px;
|
159 |
+
box-shadow: 0 5px 20px rgba(0,0,0,0.1);
|
160 |
+
margin-top: 5px;
|
161 |
+
max-height: 300px;
|
162 |
+
overflow-y: auto;
|
163 |
+
display: none;
|
164 |
+
z-index: 1000;
|
165 |
+
}
|
166 |
+
|
167 |
+
.search-suggestions.active {
|
168 |
+
display: block;
|
169 |
+
}
|
170 |
+
|
171 |
+
.suggestion-item {
|
172 |
+
padding: 12px 20px;
|
173 |
+
cursor: pointer;
|
174 |
+
transition: background 0.2s;
|
175 |
+
border-bottom: 1px solid #f0f0f0;
|
176 |
+
}
|
177 |
+
|
178 |
+
.suggestion-item:hover {
|
179 |
+
background: #f5f7fa;
|
180 |
+
}
|
181 |
+
|
182 |
+
.suggestion-item:last-child {
|
183 |
+
border-bottom: none;
|
184 |
+
}
|
185 |
+
|
186 |
+
.suggestion-highlight {
|
187 |
+
font-weight: bold;
|
188 |
+
color: #667eea;
|
189 |
+
}
|
190 |
+
|
191 |
+
.search-stats {
|
192 |
+
text-align: center;
|
193 |
+
color: #666;
|
194 |
+
margin-bottom: 20px;
|
195 |
+
font-size: 0.95rem;
|
196 |
+
}
|
197 |
+
|
198 |
+
.no-results {
|
199 |
+
text-align: center;
|
200 |
+
padding: 60px 20px;
|
201 |
+
color: #999;
|
202 |
+
}
|
203 |
+
|
204 |
+
.no-results-icon {
|
205 |
+
font-size: 4rem;
|
206 |
+
margin-bottom: 20px;
|
207 |
+
opacity: 0.5;
|
208 |
+
}
|
209 |
+
|
210 |
+
.clear-search {
|
211 |
+
position: absolute;
|
212 |
+
right: 45px;
|
213 |
+
top: 50%;
|
214 |
+
transform: translateY(-50%);
|
215 |
+
background: #e0e0e0;
|
216 |
+
border: none;
|
217 |
+
border-radius: 50%;
|
218 |
+
width: 20px;
|
219 |
+
height: 20px;
|
220 |
+
cursor: pointer;
|
221 |
+
display: none;
|
222 |
+
align-items: center;
|
223 |
+
justify-content: center;
|
224 |
+
font-size: 0.8rem;
|
225 |
+
color: #666;
|
226 |
+
transition: all 0.2s;
|
227 |
+
}
|
228 |
+
|
229 |
+
.clear-search:hover {
|
230 |
+
background: #d0d0d0;
|
231 |
+
}
|
232 |
+
|
233 |
+
.clear-search.active {
|
234 |
+
display: flex;
|
235 |
+
}
|
236 |
+
|
237 |
.filter-buttons {
|
238 |
display: flex;
|
239 |
gap: 15px;
|
|
|
489 |
<div class="section-header">
|
490 |
<h2>๐ Trending Models</h2>
|
491 |
</div>
|
492 |
+
<div class="search-container">
|
493 |
+
<div class="search-input-wrapper">
|
494 |
+
<input type="text" class="search-input" id="models-search" placeholder="Search models, authors, or tags...">
|
495 |
+
<button class="clear-search" onclick="clearSearch('models')">โ</button>
|
496 |
+
<span class="search-icon">๐</span>
|
497 |
+
<div class="search-suggestions" id="models-suggestions"></div>
|
498 |
+
</div>
|
499 |
+
<select class="filter-select" id="models-category-filter">
|
500 |
+
<option value="">All Categories</option>
|
501 |
+
<option value="text-generation">Text Generation</option>
|
502 |
+
<option value="text-to-image">Image Generation</option>
|
503 |
+
<option value="automatic-speech-recognition">Speech Recognition</option>
|
504 |
+
<option value="text-to-audio">Audio Generation</option>
|
505 |
+
<option value="image-text-to-text">Vision-Language</option>
|
506 |
+
</select>
|
507 |
+
<select class="filter-select" id="models-sort-filter">
|
508 |
+
<option value="likes">Most Liked</option>
|
509 |
+
<option value="downloads">Most Downloaded</option>
|
510 |
+
<option value="recent">Recently Added</option>
|
511 |
+
</select>
|
512 |
+
</div>
|
513 |
+
<div class="search-stats" id="models-search-stats"></div>
|
514 |
<div id="hf-models-content" class="items-grid">
|
515 |
<div class="loading">
|
516 |
<div class="loading-spinner"></div>
|
|
|
524 |
<div class="section-header">
|
525 |
<h2>๐ฏ Trending Spaces</h2>
|
526 |
</div>
|
527 |
+
<div class="search-container">
|
528 |
+
<div class="search-input-wrapper">
|
529 |
+
<input type="text" class="search-input" id="spaces-search" placeholder="Search spaces or authors...">
|
530 |
+
<button class="clear-search" onclick="clearSearch('spaces')">โ</button>
|
531 |
+
<span class="search-icon">๐</span>
|
532 |
+
<div class="search-suggestions" id="spaces-suggestions"></div>
|
533 |
+
</div>
|
534 |
+
<select class="filter-select" id="spaces-sdk-filter">
|
535 |
+
<option value="">All SDKs</option>
|
536 |
+
<option value="gradio">Gradio</option>
|
537 |
+
<option value="streamlit">Streamlit</option>
|
538 |
+
<option value="static">Static</option>
|
539 |
+
<option value="docker">Docker</option>
|
540 |
+
</select>
|
541 |
+
<select class="filter-select" id="spaces-sort-filter">
|
542 |
+
<option value="likes">Most Liked</option>
|
543 |
+
<option value="recent">Recently Added</option>
|
544 |
+
</select>
|
545 |
+
</div>
|
546 |
+
<div class="search-stats" id="spaces-search-stats"></div>
|
547 |
<div id="hf-spaces-content" class="items-grid">
|
548 |
<div class="loading">
|
549 |
<div class="loading-spinner"></div>
|
|
|
558 |
<h2>โ
Official Collection</h2>
|
559 |
<p style="color: #7f8c8d; margin-top: 5px;">from replicate.com/collections/official</p>
|
560 |
</div>
|
561 |
+
<div class="search-container">
|
562 |
+
<div class="search-input-wrapper">
|
563 |
+
<input type="text" class="search-input" id="replicate-search" placeholder="Search replicate models...">
|
564 |
+
<button class="clear-search" onclick="clearSearch('replicate')">โ</button>
|
565 |
+
<span class="search-icon">๐</span>
|
566 |
+
</div>
|
567 |
+
</div>
|
568 |
+
<div class="search-stats" id="replicate-search-stats"></div>
|
569 |
<div id="replicate-content" class="items-grid">
|
570 |
<div class="loading">
|
571 |
<div class="loading-spinner"></div>
|
|
|
579 |
|
580 |
<script>
|
581 |
let currentCategory = 'hf-models';
|
582 |
+
let allModelsData = [];
|
583 |
+
let allSpacesData = [];
|
584 |
+
let allReplicateData = [];
|
585 |
+
let filteredModelsData = [];
|
586 |
+
let filteredSpacesData = [];
|
587 |
+
let filteredReplicateData = [];
|
588 |
+
let searchHistory = [];
|
589 |
|
590 |
// Replicate URL ๋ฆฌ์คํธ
|
591 |
const replicateUrls = [
|
|
|
745 |
// Replicate ๋ชจ๋ธ ๋ก๋
|
746 |
function loadReplicate() {
|
747 |
const container = document.getElementById('replicate-content');
|
|
|
748 |
|
749 |
// URL์์ ๋ชจ๋ธ ์ ๋ณด ์ถ์ถ
|
750 |
+
allReplicateData = replicateUrls.map((url, index) => {
|
751 |
const parts = url.split('/');
|
752 |
const author = parts[parts.length - 2];
|
753 |
const modelName = parts[parts.length - 1];
|
|
|
762 |
};
|
763 |
});
|
764 |
|
765 |
+
// ์ด๊ธฐ ํํฐ๋ง ๋ฐ ํ์
|
766 |
+
filteredReplicateData = [...allReplicateData];
|
767 |
+
filterAndDisplayReplicate();
|
|
|
|
|
768 |
}
|
769 |
|
770 |
// ํ๋ก์ ์์ฒญ
|
|
|
794 |
|
795 |
// HuggingFace Models ํ์
|
796 |
function displayHFModels(models, container) {
|
797 |
+
// ์๋ณธ ๋ฐ์ดํฐ ์ ์ฅ
|
798 |
+
allModelsData = models.map((model, index) => {
|
799 |
// ์์ฑ์ผ์ ํ์ธ (1์ฃผ์ผ ์ด๋ด์ธ์ง)
|
800 |
let isNew = false;
|
801 |
if (model.createdAt) {
|
|
|
805 |
isNew = createdDate > oneWeekAgo;
|
806 |
}
|
807 |
|
808 |
+
return {
|
809 |
rank: index + 1,
|
810 |
title: model.id?.split('/')[1] || model.modelId || 'Unknown',
|
811 |
author: model.id?.split('/')[0] || model.author || 'Unknown',
|
|
|
815 |
pipeline_tag: model.pipeline_tag || '',
|
816 |
url: `https://huggingface.co/${model.id || model.modelId}`,
|
817 |
icon: '๐ค',
|
818 |
+
badge: isNew ? '๐ New' : null,
|
819 |
+
createdAt: model.createdAt
|
820 |
+
};
|
821 |
});
|
822 |
+
|
823 |
+
// ์ด๊ธฐ ํํฐ๋ง ๋ฐ ํ์
|
824 |
+
filteredModelsData = [...allModelsData];
|
825 |
+
filterAndDisplayModels();
|
826 |
}
|
827 |
|
828 |
// HuggingFace Spaces ํ์
|
829 |
function displayHFSpaces(spaces, container) {
|
830 |
+
// ์๋ณธ ๋ฐ์ดํฐ ์ ์ฅ
|
831 |
+
allSpacesData = spaces.map((space, index) => {
|
832 |
// ์์ฑ์ผ์ ํ์ธ (1์ฃผ์ผ ์ด๋ด์ธ์ง)
|
833 |
let isNew = false;
|
834 |
if (space.createdAt) {
|
|
|
838 |
isNew = createdDate > oneWeekAgo;
|
839 |
}
|
840 |
|
841 |
+
return {
|
842 |
rank: index + 1,
|
843 |
title: space.id?.split('/')[1] || 'Unknown',
|
844 |
author: space.id?.split('/')[0] || 'Unknown',
|
|
|
847 |
emoji: space.emoji || '๐ฏ',
|
848 |
url: `https://huggingface.co/spaces/${space.id}`,
|
849 |
icon: space.emoji || '๐ฏ',
|
850 |
+
badge: isNew ? '๐ New' : null,
|
851 |
+
createdAt: space.createdAt
|
852 |
+
};
|
853 |
});
|
854 |
+
|
855 |
+
// ์ด๊ธฐ ํํฐ๋ง ๋ฐ ํ์
|
856 |
+
filteredSpacesData = [...allSpacesData];
|
857 |
+
filterAndDisplaySpaces();
|
858 |
}
|
859 |
|
860 |
// ๋ชจ๋ธ ์นด๋ ์์ฑ
|
|
|
923 |
// ์ํ ๋ฐ์ดํฐ ํ์ ํจ์๋ค
|
924 |
function displaySampleHFModels(container) {
|
925 |
const sampleData = [
|
926 |
+
{ rank: 1, title: 'Llama-3.3-70B-Instruct', author: 'meta-llama', likes: 177000, downloads: 1150000, icon: '๐ค', pipeline_tag: 'text-generation', tags: ['llama', '70b', 'instruct'], createdAt: new Date(Date.now() - 10 * 24 * 60 * 60 * 1000).toISOString() },
|
927 |
+
{ rank: 2, title: 'DeepSeek-R1-Distill-Qwen-32B', author: 'deepseek-ai', likes: 10400, downloads: 567000, icon: '๐ค', pipeline_tag: 'text-generation', tags: ['deepseek', 'reasoning'], badge: '๐ New', createdAt: new Date(Date.now() - 3 * 24 * 60 * 60 * 1000).toISOString() },
|
928 |
+
{ rank: 3, title: 'Qwen3-235B-A22B', author: 'Qwen', likes: 5370, downloads: 225000, icon: '๐ค', pipeline_tag: 'text-generation', tags: ['qwen', 'large'], badge: '๐ New', createdAt: new Date(Date.now() - 5 * 24 * 60 * 60 * 1000).toISOString() },
|
929 |
+
{ rank: 4, title: 'FLUX.1-dev', author: 'black-forest-labs', likes: 29100, downloads: 397000, icon: '๐ค', pipeline_tag: 'text-to-image', tags: ['flux', 'diffusion'], createdAt: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000).toISOString() },
|
930 |
+
{ rank: 5, title: 'Phi-4', author: 'microsoft', likes: 8900, downloads: 156000, icon: '๐ค', pipeline_tag: 'text-generation', tags: ['phi', 'small'], badge: '๐ New', createdAt: new Date(Date.now() - 2 * 24 * 60 * 60 * 1000).toISOString() },
|
931 |
+
{ rank: 6, title: 'stable-diffusion-3.5-large', author: 'stabilityai', likes: 7650, downloads: 234000, icon: '๐ค', pipeline_tag: 'text-to-image', tags: ['sd3', 'large'], createdAt: new Date(Date.now() - 15 * 24 * 60 * 60 * 1000).toISOString() },
|
932 |
+
{ rank: 7, title: 'whisper-large-v3-turbo', author: 'openai', likes: 6780, downloads: 189000, icon: '๐ค', pipeline_tag: 'automatic-speech-recognition', tags: ['whisper', 'asr'], createdAt: new Date(Date.now() - 20 * 24 * 60 * 60 * 1000).toISOString() },
|
933 |
+
{ rank: 8, title: 'MusicGen-Stereo-Melody', author: 'facebook', likes: 5430, downloads: 98000, icon: '๐ค', pipeline_tag: 'text-to-audio', tags: ['music', 'generation'], createdAt: new Date(Date.now() - 25 * 24 * 60 * 60 * 1000).toISOString() },
|
934 |
+
{ rank: 9, title: 'Florence-2-large', author: 'microsoft', likes: 4890, downloads: 87000, icon: '๐ค', pipeline_tag: 'image-text-to-text', tags: ['vision', 'florence'], createdAt: new Date(Date.now() - 18 * 24 * 60 * 60 * 1000).toISOString() },
|
935 |
+
{ rank: 10, title: 'QwQ-32B-Preview', author: 'Qwen', likes: 4560, downloads: 76000, icon: '๐ค', pipeline_tag: 'text-generation', tags: ['reasoning', 'cot'], badge: '๐ New', createdAt: new Date(Date.now() - 6 * 24 * 60 * 60 * 1000).toISOString() }
|
936 |
];
|
937 |
|
|
|
938 |
sampleData.forEach(model => {
|
939 |
model.url = `https://huggingface.co/${model.author}/${model.title}`;
|
|
|
940 |
});
|
941 |
+
|
942 |
+
displayHFModels(sampleData, container);
|
943 |
}
|
944 |
|
945 |
function displaySampleHFSpaces(container) {
|
946 |
const sampleData = [
|
947 |
+
{ rank: 1, title: 'stable-diffusion-webui', author: 'stabilityai', likes: 75500, sdk: 'Gradio', icon: '๐จ', createdAt: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000).toISOString() },
|
948 |
+
{ rank: 2, title: 'chatgpt-clone', author: 'community', likes: 12300, sdk: 'Streamlit', icon: '๐ฌ', badge: '๐ New', createdAt: new Date(Date.now() - 4 * 24 * 60 * 60 * 1000).toISOString() },
|
949 |
+
{ rank: 3, title: 'InstantID', author: 'InstantX', likes: 8590, sdk: 'Gradio', icon: '๐ค', createdAt: new Date(Date.now() - 12 * 24 * 60 * 60 * 1000).toISOString() },
|
950 |
+
{ rank: 4, title: 'voice-clone-xtts', author: 'coqui', likes: 5640, sdk: 'Gradio', icon: '๐ค', badge: '๐ New', createdAt: new Date(Date.now() - 5 * 24 * 60 * 60 * 1000).toISOString() },
|
951 |
+
{ rank: 5, title: 'code-llama-playground', author: 'meta', likes: 3210, sdk: 'Gradio', icon: '๐ป', createdAt: new Date(Date.now() - 20 * 24 * 60 * 60 * 1000).toISOString() },
|
952 |
+
{ rank: 6, title: 'image-to-3d-model', author: '3d-ai', likes: 2890, sdk: 'Gradio', icon: '๐ฒ', createdAt: new Date(Date.now() - 15 * 24 * 60 * 60 * 1000).toISOString() },
|
953 |
+
{ rank: 7, title: 'music-visualizer', author: 'audio-viz', likes: 2340, sdk: 'Streamlit', icon: '๐ต', badge: '๐ New', createdAt: new Date(Date.now() - 3 * 24 * 60 * 60 * 1000).toISOString() },
|
954 |
+
{ rank: 8, title: 'pdf-chatbot', author: 'doc-ai', likes: 1980, sdk: 'Gradio', icon: '๐', createdAt: new Date(Date.now() - 25 * 24 * 60 * 60 * 1000).toISOString() },
|
955 |
+
{ rank: 9, title: 'anime-art-generator', author: 'waifu-ai', likes: 1670, sdk: 'Gradio', icon: '๐', createdAt: new Date(Date.now() - 10 * 24 * 60 * 60 * 1000).toISOString() },
|
956 |
+
{ rank: 10, title: 'dataset-explorer', author: 'data-tools', likes: 1450, sdk: 'Streamlit', icon: '๐', createdAt: new Date(Date.now() - 8 * 24 * 60 * 60 * 1000).toISOString() }
|
957 |
];
|
958 |
|
|
|
959 |
sampleData.forEach(space => {
|
960 |
space.url = `https://huggingface.co/spaces/${space.author}/${space.title}`;
|
|
|
961 |
});
|
962 |
+
|
963 |
+
displayHFSpaces(sampleData, container);
|
964 |
}
|
965 |
|
966 |
// ์๋ก๊ณ ์นจ
|
|
|
974 |
}
|
975 |
}
|
976 |
|
977 |
+
// ๊ฒ์ ๋ฐ ํํฐ๋ง ํจ์๋ค
|
978 |
+
function setupSearchAndFilter() {
|
979 |
+
// ๋ชจ๋ธ ๊ฒ์
|
980 |
+
const modelsSearchInput = document.getElementById('models-search');
|
981 |
+
const modelsCategoryFilter = document.getElementById('models-category-filter');
|
982 |
+
const modelsSortFilter = document.getElementById('models-sort-filter');
|
983 |
+
|
984 |
+
modelsSearchInput.addEventListener('input', debounce(() => {
|
985 |
+
filterAndDisplayModels();
|
986 |
+
updateSearchSuggestions('models', modelsSearchInput.value);
|
987 |
+
toggleClearButton('models', modelsSearchInput.value);
|
988 |
+
}, 300));
|
989 |
+
|
990 |
+
modelsCategoryFilter.addEventListener('change', filterAndDisplayModels);
|
991 |
+
modelsSortFilter.addEventListener('change', filterAndDisplayModels);
|
992 |
+
|
993 |
+
// ์คํ์ด์ค ๊ฒ์
|
994 |
+
const spacesSearchInput = document.getElementById('spaces-search');
|
995 |
+
const spacesSdkFilter = document.getElementById('spaces-sdk-filter');
|
996 |
+
const spacesSortFilter = document.getElementById('spaces-sort-filter');
|
997 |
+
|
998 |
+
spacesSearchInput.addEventListener('input', debounce(() => {
|
999 |
+
filterAndDisplaySpaces();
|
1000 |
+
updateSearchSuggestions('spaces', spacesSearchInput.value);
|
1001 |
+
toggleClearButton('spaces', spacesSearchInput.value);
|
1002 |
+
}, 300));
|
1003 |
+
|
1004 |
+
spacesSdkFilter.addEventListener('change', filterAndDisplaySpaces);
|
1005 |
+
spacesSortFilter.addEventListener('change', filterAndDisplaySpaces);
|
1006 |
+
|
1007 |
+
// Replicate ๊ฒ์
|
1008 |
+
const replicateSearchInput = document.getElementById('replicate-search');
|
1009 |
+
replicateSearchInput.addEventListener('input', debounce(() => {
|
1010 |
+
filterAndDisplayReplicate();
|
1011 |
+
toggleClearButton('replicate', replicateSearchInput.value);
|
1012 |
+
}, 300));
|
1013 |
+
|
1014 |
+
// ๊ฒ์์ฐฝ ํฌ์ปค์ค ์ด๋ฒคํธ
|
1015 |
+
modelsSearchInput.addEventListener('focus', () => showSearchSuggestions('models'));
|
1016 |
+
spacesSearchInput.addEventListener('focus', () => showSearchSuggestions('spaces'));
|
1017 |
+
|
1018 |
+
// ํด๋ฆญ ์ธ๋ถ ์์ญ ์ ์ ์ ์จ๊ธฐ๊ธฐ
|
1019 |
+
document.addEventListener('click', (e) => {
|
1020 |
+
if (!e.target.closest('.search-input-wrapper')) {
|
1021 |
+
hideAllSuggestions();
|
1022 |
+
}
|
1023 |
+
});
|
1024 |
+
}
|
1025 |
+
|
1026 |
+
// ๋๋ฐ์ด์ค ํจ์
|
1027 |
+
function debounce(func, wait) {
|
1028 |
+
let timeout;
|
1029 |
+
return function executedFunction(...args) {
|
1030 |
+
const later = () => {
|
1031 |
+
clearTimeout(timeout);
|
1032 |
+
func(...args);
|
1033 |
+
};
|
1034 |
+
clearTimeout(timeout);
|
1035 |
+
timeout = setTimeout(later, wait);
|
1036 |
+
};
|
1037 |
+
}
|
1038 |
+
|
1039 |
+
// ๋ชจ๋ธ ํํฐ๋ง ๋ฐ ํ์
|
1040 |
+
function filterAndDisplayModels() {
|
1041 |
+
const searchTerm = document.getElementById('models-search').value.toLowerCase();
|
1042 |
+
const categoryFilter = document.getElementById('models-category-filter').value;
|
1043 |
+
const sortFilter = document.getElementById('models-sort-filter').value;
|
1044 |
+
|
1045 |
+
// ํํฐ๋ง
|
1046 |
+
filteredModelsData = allModelsData.filter(model => {
|
1047 |
+
const matchesSearch = !searchTerm ||
|
1048 |
+
model.title.toLowerCase().includes(searchTerm) ||
|
1049 |
+
model.author.toLowerCase().includes(searchTerm) ||
|
1050 |
+
(model.tags && model.tags.some(tag => tag.toLowerCase().includes(searchTerm)));
|
1051 |
+
|
1052 |
+
const matchesCategory = !categoryFilter || model.pipeline_tag === categoryFilter;
|
1053 |
+
|
1054 |
+
return matchesSearch && matchesCategory;
|
1055 |
+
});
|
1056 |
+
|
1057 |
+
// ์ ๋ ฌ
|
1058 |
+
sortData(filteredModelsData, sortFilter);
|
1059 |
+
|
1060 |
+
// ํ์
|
1061 |
+
displayFilteredModels();
|
1062 |
+
updateSearchStats('models', filteredModelsData.length, allModelsData.length);
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
// ์คํ์ด์ค ํํฐ๋ง ๋ฐ ํ์
|
1066 |
+
function filterAndDisplaySpaces() {
|
1067 |
+
const searchTerm = document.getElementById('spaces-search').value.toLowerCase();
|
1068 |
+
const sdkFilter = document.getElementById('spaces-sdk-filter').value;
|
1069 |
+
const sortFilter = document.getElementById('spaces-sort-filter').value;
|
1070 |
+
|
1071 |
+
// ํํฐ๋ง
|
1072 |
+
filteredSpacesData = allSpacesData.filter(space => {
|
1073 |
+
const matchesSearch = !searchTerm ||
|
1074 |
+
space.title.toLowerCase().includes(searchTerm) ||
|
1075 |
+
space.author.toLowerCase().includes(searchTerm);
|
1076 |
+
|
1077 |
+
const matchesSdk = !sdkFilter ||
|
1078 |
+
(space.sdk && space.sdk.toLowerCase() === sdkFilter.toLowerCase());
|
1079 |
+
|
1080 |
+
return matchesSearch && matchesSdk;
|
1081 |
+
});
|
1082 |
+
|
1083 |
+
// ์ ๋ ฌ
|
1084 |
+
sortData(filteredSpacesData, sortFilter);
|
1085 |
+
|
1086 |
+
// ํ์
|
1087 |
+
displayFilteredSpaces();
|
1088 |
+
updateSearchStats('spaces', filteredSpacesData.length, allSpacesData.length);
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
// ๋ฐ์ดํฐ ์ ๋ ฌ
|
1092 |
+
function sortData(data, sortType) {
|
1093 |
+
switch(sortType) {
|
1094 |
+
case 'likes':
|
1095 |
+
data.sort((a, b) => (b.likes || 0) - (a.likes || 0));
|
1096 |
+
break;
|
1097 |
+
case 'downloads':
|
1098 |
+
data.sort((a, b) => (b.downloads || 0) - (a.downloads || 0));
|
1099 |
+
break;
|
1100 |
+
case 'recent':
|
1101 |
+
data.sort((a, b) => {
|
1102 |
+
const dateA = new Date(a.createdAt || 0);
|
1103 |
+
const dateB = new Date(b.createdAt || 0);
|
1104 |
+
return dateB - dateA;
|
1105 |
+
});
|
1106 |
+
break;
|
1107 |
+
}
|
1108 |
+
}
|
1109 |
+
|
1110 |
+
// ํํฐ๋ง๋ ๋ชจ๋ธ ํ์
|
1111 |
+
function displayFilteredModels() {
|
1112 |
+
const container = document.getElementById('hf-models-content');
|
1113 |
+
container.innerHTML = '';
|
1114 |
+
|
1115 |
+
if (filteredModelsData.length === 0) {
|
1116 |
+
container.innerHTML = `
|
1117 |
+
<div class="no-results">
|
1118 |
+
<div class="no-results-icon">๐</div>
|
1119 |
+
<h3>No models found</h3>
|
1120 |
+
<p>Try adjusting your search or filters</p>
|
1121 |
+
</div>
|
1122 |
+
`;
|
1123 |
+
return;
|
1124 |
+
}
|
1125 |
+
|
1126 |
+
filteredModelsData.forEach((model, index) => {
|
1127 |
+
const card = createModelCard({
|
1128 |
+
...model,
|
1129 |
+
rank: index + 1
|
1130 |
+
});
|
1131 |
+
container.appendChild(card);
|
1132 |
+
});
|
1133 |
+
}
|
1134 |
+
|
1135 |
+
// ํํฐ๋ง๋ ์คํ์ด์ค ํ์
|
1136 |
+
function displayFilteredSpaces() {
|
1137 |
+
const container = document.getElementById('hf-spaces-content');
|
1138 |
+
container.innerHTML = '';
|
1139 |
+
|
1140 |
+
if (filteredSpacesData.length === 0) {
|
1141 |
+
container.innerHTML = `
|
1142 |
+
<div class="no-results">
|
1143 |
+
<div class="no-results-icon">๐</div>
|
1144 |
+
<h3>No spaces found</h3>
|
1145 |
+
<p>Try adjusting your search or filters</p>
|
1146 |
+
</div>
|
1147 |
+
`;
|
1148 |
+
return;
|
1149 |
+
}
|
1150 |
+
|
1151 |
+
filteredSpacesData.forEach((space, index) => {
|
1152 |
+
const card = createModelCard({
|
1153 |
+
...space,
|
1154 |
+
rank: index + 1
|
1155 |
+
});
|
1156 |
+
container.appendChild(card);
|
1157 |
+
});
|
1158 |
+
}
|
1159 |
+
|
1160 |
+
// ๊ฒ์ ์ ์ ์
๋ฐ์ดํธ
|
1161 |
+
function updateSearchSuggestions(type, searchTerm) {
|
1162 |
+
if (!searchTerm) {
|
1163 |
+
hideAllSuggestions();
|
1164 |
+
return;
|
1165 |
+
}
|
1166 |
+
|
1167 |
+
const data = type === 'models' ? allModelsData : allSpacesData;
|
1168 |
+
const suggestions = data
|
1169 |
+
.filter(item =>
|
1170 |
+
item.title.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
1171 |
+
item.author.toLowerCase().includes(searchTerm.toLowerCase())
|
1172 |
+
)
|
1173 |
+
.slice(0, 5);
|
1174 |
+
|
1175 |
+
const suggestionsContainer = document.getElementById(`${type}-suggestions`);
|
1176 |
+
suggestionsContainer.innerHTML = suggestions.map(item => `
|
1177 |
+
<div class="suggestion-item" onclick="selectSuggestion('${type}', '${item.title}')">
|
1178 |
+
<strong>${highlightMatch(item.title, searchTerm)}</strong>
|
1179 |
+
<span style="color: #999; font-size: 0.9rem;"> by ${item.author}</span>
|
1180 |
+
</div>
|
1181 |
+
`).join('');
|
1182 |
+
|
1183 |
+
suggestionsContainer.classList.add('active');
|
1184 |
+
}
|
1185 |
+
|
1186 |
+
// ๊ฒ์์ด ํ์ด๋ผ์ดํธ
|
1187 |
+
function highlightMatch(text, searchTerm) {
|
1188 |
+
const regex = new RegExp(`(${searchTerm})`, 'gi');
|
1189 |
+
return text.replace(regex, '<span class="suggestion-highlight">$1</span>');
|
1190 |
+
}
|
1191 |
+
|
1192 |
+
// ์ ์ ์ ํ
|
1193 |
+
function selectSuggestion(type, value) {
|
1194 |
+
document.getElementById(`${type}-search`).value = value;
|
1195 |
+
hideAllSuggestions();
|
1196 |
+
if (type === 'models') {
|
1197 |
+
filterAndDisplayModels();
|
1198 |
+
} else {
|
1199 |
+
filterAndDisplaySpaces();
|
1200 |
+
}
|
1201 |
+
}
|
1202 |
+
|
1203 |
+
// ๊ฒ์ ์ ์ ํ์
|
1204 |
+
function showSearchSuggestions(type) {
|
1205 |
+
const searchTerm = document.getElementById(`${type}-search`).value;
|
1206 |
+
if (searchTerm) {
|
1207 |
+
updateSearchSuggestions(type, searchTerm);
|
1208 |
+
}
|
1209 |
+
}
|
1210 |
+
|
1211 |
+
// ๋ชจ๋ ์ ์ ์จ๊ธฐ๊ธฐ
|
1212 |
+
function hideAllSuggestions() {
|
1213 |
+
document.querySelectorAll('.search-suggestions').forEach(el => {
|
1214 |
+
el.classList.remove('active');
|
1215 |
+
});
|
1216 |
+
}
|
1217 |
+
|
1218 |
+
// ๊ฒ์ ํต๊ณ ์
๋ฐ์ดํธ
|
1219 |
+
function updateSearchStats(type, shown, total) {
|
1220 |
+
const statsEl = document.getElementById(`${type}-search-stats`);
|
1221 |
+
if (shown < total) {
|
1222 |
+
statsEl.textContent = `Showing ${shown} of ${total} ${type}`;
|
1223 |
+
} else {
|
1224 |
+
statsEl.textContent = '';
|
1225 |
+
}
|
1226 |
+
}
|
1227 |
+
|
1228 |
+
// ๊ฒ์ ์ง์ฐ๊ธฐ ๋ฒํผ ํ ๊ธ
|
1229 |
+
function toggleClearButton(type, value) {
|
1230 |
+
const clearBtn = document.querySelector(`#${type}-search + .clear-search`);
|
1231 |
+
if (value) {
|
1232 |
+
clearBtn.classList.add('active');
|
1233 |
+
} else {
|
1234 |
+
clearBtn.classList.remove('active');
|
1235 |
+
}
|
1236 |
+
}
|
1237 |
+
|
1238 |
+
// Replicate ํํฐ๋ง ๋ฐ ํ์
|
1239 |
+
function filterAndDisplayReplicate() {
|
1240 |
+
const searchTerm = document.getElementById('replicate-search').value.toLowerCase();
|
1241 |
+
|
1242 |
+
// ํํฐ๋ง
|
1243 |
+
filteredReplicateData = allReplicateData.filter(model => {
|
1244 |
+
return !searchTerm ||
|
1245 |
+
model.title.toLowerCase().includes(searchTerm) ||
|
1246 |
+
model.author.toLowerCase().includes(searchTerm);
|
1247 |
+
});
|
1248 |
+
|
1249 |
+
// ํ์
|
1250 |
+
displayFilteredReplicate();
|
1251 |
+
updateSearchStats('replicate', filteredReplicateData.length, allReplicateData.length);
|
1252 |
+
}
|
1253 |
+
|
1254 |
+
// ํํฐ๋ง๋ Replicate ๋ชจ๋ธ ํ์
|
1255 |
+
function displayFilteredReplicate() {
|
1256 |
+
const container = document.getElementById('replicate-content');
|
1257 |
+
container.innerHTML = '';
|
1258 |
+
|
1259 |
+
if (filteredReplicateData.length === 0) {
|
1260 |
+
container.innerHTML = `
|
1261 |
+
<div class="no-results">
|
1262 |
+
<div class="no-results-icon">๐</div>
|
1263 |
+
<h3>No models found</h3>
|
1264 |
+
<p>Try adjusting your search</p>
|
1265 |
+
</div>
|
1266 |
+
`;
|
1267 |
+
return;
|
1268 |
+
}
|
1269 |
+
|
1270 |
+
filteredReplicateData.forEach((model, index) => {
|
1271 |
+
const card = createModelCard({
|
1272 |
+
...model,
|
1273 |
+
rank: index + 1
|
1274 |
+
});
|
1275 |
+
container.appendChild(card);
|
1276 |
+
});
|
1277 |
+
}
|
1278 |
+
|
1279 |
+
// ๊ฒ์ ์ง์ฐ๊ธฐ
|
1280 |
+
function clearSearch(type) {
|
1281 |
+
document.getElementById(`${type}-search`).value = '';
|
1282 |
+
toggleClearButton(type, '');
|
1283 |
+
if (type === 'models') {
|
1284 |
+
filterAndDisplayModels();
|
1285 |
+
} else if (type === 'spaces') {
|
1286 |
+
filterAndDisplaySpaces();
|
1287 |
+
} else if (type === 'replicate') {
|
1288 |
+
filterAndDisplayReplicate();
|
1289 |
+
}
|
1290 |
+
}
|
1291 |
+
|
1292 |
// ์ด๊ธฐ ๋ก๋
|
1293 |
window.addEventListener('DOMContentLoaded', () => {
|
1294 |
+
setupSearchAndFilter();
|
1295 |
loadHFModels();
|
1296 |
});
|
1297 |
</script>
|