Update index.html
Browse files- index.html +44 -40
index.html
CHANGED
@@ -48,7 +48,7 @@
|
|
48 |
}
|
49 |
.main-container {
|
50 |
display: flex;
|
51 |
-
height: calc(100vh - 100px);
|
52 |
}
|
53 |
#sidebar {
|
54 |
width: 25%;
|
@@ -72,7 +72,6 @@
|
|
72 |
#sidebar li:hover {
|
73 |
background-color: #f0f0f0;
|
74 |
}
|
75 |
-
/* 우측 임베드 영역: 남은 공간을 모두 차지 */
|
76 |
#embed-container {
|
77 |
flex: 1;
|
78 |
padding: 0;
|
@@ -93,26 +92,19 @@
|
|
93 |
</div>
|
94 |
|
95 |
<!-- 필터 버튼 영역 (미리 정의한 10가지 그룹: NEW, BEST, Text, Image Gen, Image Edit, Audio, Video, Productivity, Utility, Vision) -->
|
96 |
-
<div class="filter-group" id="filter-group">
|
97 |
-
<!-- JavaScript로 동적으로 버튼 생성 -->
|
98 |
-
</div>
|
99 |
|
100 |
<div class="main-container">
|
101 |
-
|
102 |
-
<div id="sidebar">
|
103 |
-
<!-- JavaScript로 동적으로 생성 -->
|
104 |
-
</div>
|
105 |
-
<!-- 우측 임베드 영역 -->
|
106 |
<div id="embed-container">
|
107 |
<iframe id="embed-frame" src=""></iframe>
|
108 |
</div>
|
109 |
</div>
|
110 |
|
111 |
-
|
112 |
<script>
|
113 |
-
// 1.
|
114 |
const projectList = {
|
115 |
-
"fantos/Panorama": "https://huggingface.co/spaces/fantos/Panorama",
|
116 |
"ginigen/Multi-LoRAgen": "https://huggingface.co/spaces/ginigen/Multi-LoRAgen",
|
117 |
"ginigen/canvas-studio": "https://huggingface.co/spaces/ginigen/canvas-studio",
|
118 |
"ginipick/Fashion-Stylegen": "https://huggingface.co/spaces/ginipick/Fashion-Style",
|
@@ -227,10 +219,10 @@
|
|
227 |
"aiqtech/FLUX-Ghibli-Studio-LoRA": "https://huggingface.co/spaces/aiqtech/FLUX-Ghibli-Studio-LoRA",
|
228 |
"aiqtech/flxgif": "https://huggingface.co/spaces/aiqtech/flxgif",
|
229 |
"aiqtech/imaginpaint": "https://huggingface.co/spaces/aiqtech/imaginpaint"
|
|
|
230 |
|
231 |
-
|
232 |
-
|
233 |
-
"ginigen/Multi-LoRAgen": "Image Gen",
|
234 |
"fantos/Panorama": "Image Gen",
|
235 |
"ginigen/Multi-LoRAgen": "Image Gen",
|
236 |
"ginigen/canvas-studio": "Image Edit",
|
@@ -244,9 +236,9 @@
|
|
244 |
"fantaxy/adult-novel": "Text",
|
245 |
"fantaxy/kungfu-novel": "Text",
|
246 |
"fantaxy/love-novel": "Text",
|
247 |
-
"VIDraft/mouse-webgen": "
|
248 |
"immunobiotech/MUSIC-Jukebox": "Audio",
|
249 |
-
"seawolf2357/Flowise-AI": "
|
250 |
"ginigen/Flux-LayerDiffuse": "Image Gen",
|
251 |
"VIDraft/Portrait-Animation": "Video",
|
252 |
"VIDraft/Deepseek-Multimodal": "Vision",
|
@@ -274,7 +266,7 @@
|
|
274 |
"openfree/image-to-vector": "Image Edit",
|
275 |
"ginipick/QR-Canvas-plus": "Productivity",
|
276 |
"ginigen/text3d-R1": "Image Gen",
|
277 |
-
"openfree/MagicFace-V3": "Image Edit",
|
278 |
"ginipick/DeepSeekR1-LIVE": "Text",
|
279 |
"ginigen/ColPali-multi": "Text",
|
280 |
"ginigen/Janus-Pro-7B": "Vision",
|
@@ -335,7 +327,7 @@
|
|
335 |
"ginipick/FLUXllama": "Image Gen",
|
336 |
"fantaxy/Sound-AI-SFX": "Audio",
|
337 |
"fantos/flx8lora": "Image Gen",
|
338 |
-
"openfree/trending-board": "
|
339 |
"ginipick/Realtime-FLUX": "Image Gen",
|
340 |
"aiqtech/kofaceid": "Image Gen",
|
341 |
"fantaxy/fastvideogena": "Video",
|
@@ -345,19 +337,14 @@
|
|
345 |
"aiqtech/cinevid": "Video",
|
346 |
"aiqtech/FLUX-Ghibli-Studio-LoRA": "Image Gen",
|
347 |
"aiqtech/flxgif": "Image Gen",
|
348 |
-
"aiqtech/imaginpaint": "Image Edit"
|
349 |
-
|
350 |
-
|
351 |
-
// NEW와 BEST 카테고리 추가 예시 (기본 카테고리와 중복되어도 됩니다)
|
352 |
-
// 예를 들어, "fantos/Panorama"를 NEW 카테고리에도 포함하고,
|
353 |
-
// "ginigen/Multi-LoRAgen"을 BEST 카테고리에도 포함하도록 추가합니다.
|
354 |
|
355 |
-
|
356 |
-
"fantos/Panorama_NEW": "NEW",
|
357 |
"ginigen/Multi-LoRAgen_BEST": "BEST"
|
358 |
};
|
359 |
|
360 |
-
//
|
361 |
function transformUrl(url) {
|
362 |
const prefix = "https://huggingface.co/spaces/";
|
363 |
if (url.startsWith(prefix)) {
|
@@ -367,10 +354,15 @@
|
|
367 |
return url;
|
368 |
}
|
369 |
|
370 |
-
// 4.
|
|
|
371 |
const keys = Object.keys(projectList);
|
372 |
-
const projects = keys.map(
|
|
|
|
|
373 |
let primaryCategory = customCategories[key] || "Image Gen";
|
|
|
|
|
374 |
let categories = [primaryCategory];
|
375 |
if (key.endsWith("_NEW")) {
|
376 |
categories.push("NEW");
|
@@ -378,18 +370,21 @@
|
|
378 |
if (key.endsWith("_BEST")) {
|
379 |
categories.push("BEST");
|
380 |
}
|
|
|
|
|
381 |
let projectName = key;
|
382 |
if (!key.endsWith("_NEW") && !key.endsWith("_BEST")) {
|
383 |
projectName = key.split("/").slice(1).join("/");
|
384 |
}
|
|
|
385 |
return {
|
386 |
name: primaryCategory + "/" + projectName,
|
387 |
-
url: transformUrl(
|
388 |
categories: categories
|
389 |
};
|
390 |
});
|
391 |
|
392 |
-
// 5. 카테고리별 그룹화
|
393 |
const grouped = {};
|
394 |
projects.forEach(project => {
|
395 |
project.categories.forEach(cat => {
|
@@ -400,14 +395,18 @@
|
|
400 |
});
|
401 |
});
|
402 |
|
403 |
-
// 6. 필터 버튼 생성 (
|
404 |
const fixedGroups = ["NEW", "BEST", "Text", "Image Gen", "Image Edit", "Audio", "Video", "Productivity", "Utility", "Vision"];
|
405 |
const filterGroupDiv = document.getElementById("filter-group");
|
|
|
|
|
406 |
const allButton = document.createElement("button");
|
407 |
allButton.className = "toggle-button active";
|
408 |
allButton.setAttribute("data-filter", "all");
|
409 |
allButton.textContent = "All";
|
410 |
filterGroupDiv.appendChild(allButton);
|
|
|
|
|
411 |
fixedGroups.forEach(category => {
|
412 |
const btn = document.createElement("button");
|
413 |
btn.className = "toggle-button";
|
@@ -416,21 +415,26 @@
|
|
416 |
filterGroupDiv.appendChild(btn);
|
417 |
});
|
418 |
|
419 |
-
// 7. 사이드바
|
420 |
function updateSidebar(filter) {
|
421 |
const sidebar = document.getElementById("sidebar");
|
422 |
sidebar.innerHTML = "";
|
423 |
-
let items = (filter === "all")
|
|
|
|
|
|
|
424 |
const ul = document.createElement("ul");
|
425 |
items.forEach(item => {
|
426 |
const li = document.createElement("li");
|
427 |
li.textContent = item.name;
|
428 |
-
li.addEventListener("click",
|
429 |
document.getElementById("embed-frame").setAttribute("src", item.url);
|
430 |
});
|
431 |
ul.appendChild(li);
|
432 |
});
|
433 |
sidebar.appendChild(ul);
|
|
|
|
|
434 |
if (items.length > 0) {
|
435 |
document.getElementById("embed-frame").setAttribute("src", items[0].url);
|
436 |
} else {
|
@@ -438,7 +442,7 @@
|
|
438 |
}
|
439 |
}
|
440 |
|
441 |
-
// 8.
|
442 |
document.querySelectorAll(".toggle-button").forEach(button => {
|
443 |
button.addEventListener("click", function() {
|
444 |
document.querySelectorAll(".toggle-button").forEach(btn => btn.classList.remove("active"));
|
@@ -447,8 +451,8 @@
|
|
447 |
});
|
448 |
});
|
449 |
|
450 |
-
// 9.
|
451 |
updateSidebar("all");
|
452 |
</script>
|
453 |
</body>
|
454 |
-
</html>
|
|
|
48 |
}
|
49 |
.main-container {
|
50 |
display: flex;
|
51 |
+
height: calc(100vh - 100px);
|
52 |
}
|
53 |
#sidebar {
|
54 |
width: 25%;
|
|
|
72 |
#sidebar li:hover {
|
73 |
background-color: #f0f0f0;
|
74 |
}
|
|
|
75 |
#embed-container {
|
76 |
flex: 1;
|
77 |
padding: 0;
|
|
|
92 |
</div>
|
93 |
|
94 |
<!-- 필터 버튼 영역 (미리 정의한 10가지 그룹: NEW, BEST, Text, Image Gen, Image Edit, Audio, Video, Productivity, Utility, Vision) -->
|
95 |
+
<div class="filter-group" id="filter-group"></div>
|
|
|
|
|
96 |
|
97 |
<div class="main-container">
|
98 |
+
<div id="sidebar"></div>
|
|
|
|
|
|
|
|
|
99 |
<div id="embed-container">
|
100 |
<iframe id="embed-frame" src=""></iframe>
|
101 |
</div>
|
102 |
</div>
|
103 |
|
|
|
104 |
<script>
|
105 |
+
// 1. 프로젝트 URL 목록: 프로젝트 이름 -> URL
|
106 |
const projectList = {
|
107 |
+
"fantos/Panorama": "https://huggingface.co/spaces/fantos/Panorama",
|
108 |
"ginigen/Multi-LoRAgen": "https://huggingface.co/spaces/ginigen/Multi-LoRAgen",
|
109 |
"ginigen/canvas-studio": "https://huggingface.co/spaces/ginigen/canvas-studio",
|
110 |
"ginipick/Fashion-Stylegen": "https://huggingface.co/spaces/ginipick/Fashion-Style",
|
|
|
219 |
"aiqtech/FLUX-Ghibli-Studio-LoRA": "https://huggingface.co/spaces/aiqtech/FLUX-Ghibli-Studio-LoRA",
|
220 |
"aiqtech/flxgif": "https://huggingface.co/spaces/aiqtech/flxgif",
|
221 |
"aiqtech/imaginpaint": "https://huggingface.co/spaces/aiqtech/imaginpaint"
|
222 |
+
};
|
223 |
|
224 |
+
// 2. 별도 객체: 프로젝트의 개별 카테고리 지정 (없으면 기본값 "Image Gen" 사용)
|
225 |
+
const customCategories = {
|
|
|
226 |
"fantos/Panorama": "Image Gen",
|
227 |
"ginigen/Multi-LoRAgen": "Image Gen",
|
228 |
"ginigen/canvas-studio": "Image Edit",
|
|
|
236 |
"fantaxy/adult-novel": "Text",
|
237 |
"fantaxy/kungfu-novel": "Text",
|
238 |
"fantaxy/love-novel": "Text",
|
239 |
+
"VIDraft/mouse-webgen": "Productivity",
|
240 |
"immunobiotech/MUSIC-Jukebox": "Audio",
|
241 |
+
"seawolf2357/Flowise-AI": "Productivity",
|
242 |
"ginigen/Flux-LayerDiffuse": "Image Gen",
|
243 |
"VIDraft/Portrait-Animation": "Video",
|
244 |
"VIDraft/Deepseek-Multimodal": "Vision",
|
|
|
266 |
"openfree/image-to-vector": "Image Edit",
|
267 |
"ginipick/QR-Canvas-plus": "Productivity",
|
268 |
"ginigen/text3d-R1": "Image Gen",
|
269 |
+
"openfree/MagicFace-V3": "Image Edit",
|
270 |
"ginipick/DeepSeekR1-LIVE": "Text",
|
271 |
"ginigen/ColPali-multi": "Text",
|
272 |
"ginigen/Janus-Pro-7B": "Vision",
|
|
|
327 |
"ginipick/FLUXllama": "Image Gen",
|
328 |
"fantaxy/Sound-AI-SFX": "Audio",
|
329 |
"fantos/flx8lora": "Image Gen",
|
330 |
+
"openfree/trending-board": "Utility",
|
331 |
"ginipick/Realtime-FLUX": "Image Gen",
|
332 |
"aiqtech/kofaceid": "Image Gen",
|
333 |
"fantaxy/fastvideogena": "Video",
|
|
|
337 |
"aiqtech/cinevid": "Video",
|
338 |
"aiqtech/FLUX-Ghibli-Studio-LoRA": "Image Gen",
|
339 |
"aiqtech/flxgif": "Image Gen",
|
340 |
+
"aiqtech/imaginpaint": "Image Edit",
|
|
|
|
|
|
|
|
|
|
|
341 |
|
342 |
+
// 예시로 NEW/BEST 항목 따로 지정 (키 뒤에 _NEW, _BEST 붙임)
|
343 |
+
"fantos/Panorama_NEW": "NEW",
|
344 |
"ginigen/Multi-LoRAgen_BEST": "BEST"
|
345 |
};
|
346 |
|
347 |
+
// 3. URL 변환 함수: "https://huggingface.co/spaces/{namespace}/{project}" → "https://{namespace}-{project}.hf.space"
|
348 |
function transformUrl(url) {
|
349 |
const prefix = "https://huggingface.co/spaces/";
|
350 |
if (url.startsWith(prefix)) {
|
|
|
354 |
return url;
|
355 |
}
|
356 |
|
357 |
+
// 4. 프로젝트 객체 생성
|
358 |
+
// projectList의 모든 key에 대해 customCategories에서 카테고리를 읽고, 없으면 기본 "Image Gen"
|
359 |
const keys = Object.keys(projectList);
|
360 |
+
const projects = keys.map(key => {
|
361 |
+
const url = projectList[key];
|
362 |
+
// primaryCategory가 없으면 "Image Gen"
|
363 |
let primaryCategory = customCategories[key] || "Image Gen";
|
364 |
+
|
365 |
+
// 중복 카테고리 가능 (NEW, BEST)
|
366 |
let categories = [primaryCategory];
|
367 |
if (key.endsWith("_NEW")) {
|
368 |
categories.push("NEW");
|
|
|
370 |
if (key.endsWith("_BEST")) {
|
371 |
categories.push("BEST");
|
372 |
}
|
373 |
+
|
374 |
+
// 실제 프로젝트명: "/" 뒤의 부분
|
375 |
let projectName = key;
|
376 |
if (!key.endsWith("_NEW") && !key.endsWith("_BEST")) {
|
377 |
projectName = key.split("/").slice(1).join("/");
|
378 |
}
|
379 |
+
|
380 |
return {
|
381 |
name: primaryCategory + "/" + projectName,
|
382 |
+
url: transformUrl(url),
|
383 |
categories: categories
|
384 |
};
|
385 |
});
|
386 |
|
387 |
+
// 5. 카테고리별 그룹화
|
388 |
const grouped = {};
|
389 |
projects.forEach(project => {
|
390 |
project.categories.forEach(cat => {
|
|
|
395 |
});
|
396 |
});
|
397 |
|
398 |
+
// 6. 필터 버튼 생성 (10가지 + All)
|
399 |
const fixedGroups = ["NEW", "BEST", "Text", "Image Gen", "Image Edit", "Audio", "Video", "Productivity", "Utility", "Vision"];
|
400 |
const filterGroupDiv = document.getElementById("filter-group");
|
401 |
+
|
402 |
+
// All 버튼
|
403 |
const allButton = document.createElement("button");
|
404 |
allButton.className = "toggle-button active";
|
405 |
allButton.setAttribute("data-filter", "all");
|
406 |
allButton.textContent = "All";
|
407 |
filterGroupDiv.appendChild(allButton);
|
408 |
+
|
409 |
+
// 나머지 10개 카테고리 버튼
|
410 |
fixedGroups.forEach(category => {
|
411 |
const btn = document.createElement("button");
|
412 |
btn.className = "toggle-button";
|
|
|
415 |
filterGroupDiv.appendChild(btn);
|
416 |
});
|
417 |
|
418 |
+
// 7. 사이드바 갱신 함수
|
419 |
function updateSidebar(filter) {
|
420 |
const sidebar = document.getElementById("sidebar");
|
421 |
sidebar.innerHTML = "";
|
422 |
+
let items = (filter === "all")
|
423 |
+
? projects
|
424 |
+
: projects.filter(project => project.categories.includes(filter));
|
425 |
+
|
426 |
const ul = document.createElement("ul");
|
427 |
items.forEach(item => {
|
428 |
const li = document.createElement("li");
|
429 |
li.textContent = item.name;
|
430 |
+
li.addEventListener("click", () => {
|
431 |
document.getElementById("embed-frame").setAttribute("src", item.url);
|
432 |
});
|
433 |
ul.appendChild(li);
|
434 |
});
|
435 |
sidebar.appendChild(ul);
|
436 |
+
|
437 |
+
// 첫 번째 항목 자동 표시
|
438 |
if (items.length > 0) {
|
439 |
document.getElementById("embed-frame").setAttribute("src", items[0].url);
|
440 |
} else {
|
|
|
442 |
}
|
443 |
}
|
444 |
|
445 |
+
// 8. 버튼 클릭 시 필터 적용
|
446 |
document.querySelectorAll(".toggle-button").forEach(button => {
|
447 |
button.addEventListener("click", function() {
|
448 |
document.querySelectorAll(".toggle-button").forEach(btn => btn.classList.remove("active"));
|
|
|
451 |
});
|
452 |
});
|
453 |
|
454 |
+
// 9. 초기 로딩: All 필터 적용
|
455 |
updateSidebar("all");
|
456 |
</script>
|
457 |
</body>
|
458 |
+
</html>
|