Spaces:
Running
Running
Update index.html
Browse files- index.html +55 -49
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%;
|
@@ -91,8 +91,10 @@
|
|
91 |
<a href="https://discord.gg/openfreeai" target="_blank">Community</a>
|
92 |
</div>
|
93 |
|
94 |
-
<!-- ํํฐ ๋ฒํผ ์์ญ
|
95 |
-
<div class="filter-group" id="filter-group"
|
|
|
|
|
96 |
|
97 |
<div class="main-container">
|
98 |
<div id="sidebar"></div>
|
@@ -338,13 +340,36 @@
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
function transformUrl(url) {
|
349 |
const prefix = "https://huggingface.co/spaces/";
|
350 |
if (url.startsWith(prefix)) {
|
@@ -354,59 +379,41 @@
|
|
354 |
return url;
|
355 |
}
|
356 |
|
357 |
-
//
|
358 |
-
// projectList์ ๋ชจ๋ key์ ๋ํด customCategories์์ ์นดํ
๊ณ ๋ฆฌ๋ฅผ ์ฝ๊ณ , ์์ผ๋ฉด ๊ธฐ๋ณธ "Image Gen"
|
359 |
const keys = Object.keys(projectList);
|
360 |
const projects = keys.map(key => {
|
361 |
-
const
|
362 |
-
// primaryCategory๊ฐ ์์ผ๋ฉด "Image Gen"
|
363 |
-
let primaryCategory = customCategories[key] || "Image Gen";
|
364 |
-
|
365 |
-
// ์ค๋ณต ์นดํ
๊ณ ๋ฆฌ ๊ฐ๋ฅ (NEW, BEST)
|
366 |
let categories = [primaryCategory];
|
367 |
-
|
368 |
-
|
369 |
-
|
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 + "/" +
|
382 |
-
url: transformUrl(
|
383 |
categories: categories
|
384 |
};
|
385 |
});
|
386 |
|
387 |
-
//
|
388 |
const grouped = {};
|
389 |
-
projects.forEach(
|
390 |
-
|
391 |
-
if (!grouped[cat])
|
392 |
-
|
393 |
-
}
|
394 |
-
grouped[cat].push(project);
|
395 |
});
|
396 |
});
|
397 |
|
398 |
-
//
|
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,44 +422,43 @@
|
|
415 |
filterGroupDiv.appendChild(btn);
|
416 |
});
|
417 |
|
418 |
-
//
|
419 |
function updateSidebar(filter) {
|
420 |
const sidebar = document.getElementById("sidebar");
|
421 |
sidebar.innerHTML = "";
|
422 |
let items = (filter === "all")
|
423 |
? projects
|
424 |
-
: projects.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").
|
432 |
});
|
433 |
ul.appendChild(li);
|
434 |
});
|
435 |
sidebar.appendChild(ul);
|
436 |
|
437 |
-
// ์ฒซ ๋ฒ์งธ ํญ๋ชฉ ์๋ ํ์
|
438 |
if (items.length > 0) {
|
439 |
-
document.getElementById("embed-frame").
|
440 |
} else {
|
441 |
-
document.getElementById("embed-frame").
|
442 |
}
|
443 |
}
|
444 |
|
445 |
-
//
|
446 |
document.querySelectorAll(".toggle-button").forEach(button => {
|
447 |
button.addEventListener("click", function() {
|
448 |
-
document.querySelectorAll(".toggle-button").forEach(
|
449 |
this.classList.add("active");
|
450 |
updateSidebar(this.getAttribute("data-filter"));
|
451 |
});
|
452 |
});
|
453 |
|
454 |
-
//
|
455 |
updateSidebar("all");
|
456 |
</script>
|
457 |
</body>
|
458 |
-
</html>
|
|
|
48 |
}
|
49 |
.main-container {
|
50 |
display: flex;
|
51 |
+
height: calc(100vh - 100px); /* ์๋จ ์์ญ ์ ์ธ ์ ์ฒด ๋์ด */
|
52 |
}
|
53 |
#sidebar {
|
54 |
width: 25%;
|
|
|
91 |
<a href="https://discord.gg/openfreeai" target="_blank">Community</a>
|
92 |
</div>
|
93 |
|
94 |
+
<!-- ํํฐ ๋ฒํผ ์์ญ -->
|
95 |
+
<div class="filter-group" id="filter-group">
|
96 |
+
<!-- JavaScript๋ก ๋์ ์ผ๋ก ๋ฒํผ ์์ฑ -->
|
97 |
+
</div>
|
98 |
|
99 |
<div class="main-container">
|
100 |
<div id="sidebar"></div>
|
|
|
340 |
"aiqtech/FLUX-Ghibli-Studio-LoRA": "Image Gen",
|
341 |
"aiqtech/flxgif": "Image Gen",
|
342 |
"aiqtech/imaginpaint": "Image Edit",
|
|
|
|
|
|
|
|
|
343 |
};
|
344 |
|
345 |
+
const newProjects = [
|
346 |
+
"fantos/Panorama",
|
347 |
+
"ginigen/Multi-LoRAgen",
|
348 |
+
"ginipick/Fashion-Stylegen",
|
349 |
+
"ginipick/Time-Stream",
|
350 |
+
"ginipick/AccuVision-Diffusion",
|
351 |
+
"fantos/Magic-Drawings",
|
352 |
+
"ginigen/Lumina-Image-PLUS",
|
353 |
+
"fantaxy/fantasy-novel",
|
354 |
+
"VIDraft/mouse-webgen",
|
355 |
+
"immunobiotech/MUSIC-Jukebox"
|
356 |
+
];
|
357 |
+
|
358 |
+
const bestProjects = [
|
359 |
+
"ginigen/canvas-studio",
|
360 |
+
"ginipick/Time-Stream",
|
361 |
+
"ginipick/AccuVision-Diffusion",
|
362 |
+
"fantos/Magic-Drawings",
|
363 |
+
"ginigen/Lumina-Image-PLUS",
|
364 |
+
"fantaxy/fantasy-novel",
|
365 |
+
"VIDraft/mouse-webgen",
|
366 |
+
"immunobiotech/MUSIC-Jukebox",
|
367 |
+
"seawolf2357/Flowise-AI",
|
368 |
+
"ginigen/Flux-LayerDiffuse"
|
369 |
+
];
|
370 |
+
|
371 |
+
|
372 |
+
// 4. URL ๋ณํ ํจ์
|
373 |
function transformUrl(url) {
|
374 |
const prefix = "https://huggingface.co/spaces/";
|
375 |
if (url.startsWith(prefix)) {
|
|
|
379 |
return url;
|
380 |
}
|
381 |
|
382 |
+
// 5. ํ๋ก์ ํธ ๋ฐฐ์ด ์์ฑ
|
|
|
383 |
const keys = Object.keys(projectList);
|
384 |
const projects = keys.map(key => {
|
385 |
+
const primaryCategory = customCategories[key] || "Image Gen";
|
|
|
|
|
|
|
|
|
386 |
let categories = [primaryCategory];
|
387 |
+
|
388 |
+
if (newProjects.includes(key)) categories.push("NEW");
|
389 |
+
if (bestProjects.includes(key)) categories.push("BEST");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
|
391 |
return {
|
392 |
+
name: primaryCategory + "/" + key.split("/")[1],
|
393 |
+
url: transformUrl(projectList[key]),
|
394 |
categories: categories
|
395 |
};
|
396 |
});
|
397 |
|
398 |
+
// 6. ์นดํ
๊ณ ๋ฆฌ๋ณ ๊ทธ๋ฃนํ
|
399 |
const grouped = {};
|
400 |
+
projects.forEach(proj => {
|
401 |
+
proj.categories.forEach(cat => {
|
402 |
+
if (!grouped[cat]) grouped[cat] = [];
|
403 |
+
grouped[cat].push(proj);
|
|
|
|
|
404 |
});
|
405 |
});
|
406 |
|
407 |
+
// 7. ํํฐ ๋ฒํผ ์์ฑ
|
408 |
const fixedGroups = ["NEW", "BEST", "Text", "Image Gen", "Image Edit", "Audio", "Video", "Productivity", "Utility", "Vision"];
|
409 |
const filterGroupDiv = document.getElementById("filter-group");
|
410 |
|
|
|
411 |
const allButton = document.createElement("button");
|
412 |
allButton.className = "toggle-button active";
|
413 |
allButton.setAttribute("data-filter", "all");
|
414 |
allButton.textContent = "All";
|
415 |
filterGroupDiv.appendChild(allButton);
|
416 |
|
|
|
417 |
fixedGroups.forEach(category => {
|
418 |
const btn = document.createElement("button");
|
419 |
btn.className = "toggle-button";
|
|
|
422 |
filterGroupDiv.appendChild(btn);
|
423 |
});
|
424 |
|
425 |
+
// 8. ์ฌ์ด๋๋ฐ ๊ฐฑ์ ํจ์
|
426 |
function updateSidebar(filter) {
|
427 |
const sidebar = document.getElementById("sidebar");
|
428 |
sidebar.innerHTML = "";
|
429 |
let items = (filter === "all")
|
430 |
? projects
|
431 |
+
: projects.filter(p => p.categories.includes(filter));
|
432 |
|
433 |
const ul = document.createElement("ul");
|
434 |
items.forEach(item => {
|
435 |
const li = document.createElement("li");
|
436 |
li.textContent = item.name;
|
437 |
li.addEventListener("click", () => {
|
438 |
+
document.getElementById("embed-frame").src = item.url;
|
439 |
});
|
440 |
ul.appendChild(li);
|
441 |
});
|
442 |
sidebar.appendChild(ul);
|
443 |
|
|
|
444 |
if (items.length > 0) {
|
445 |
+
document.getElementById("embed-frame").src = items[0].url;
|
446 |
} else {
|
447 |
+
document.getElementById("embed-frame").src = "";
|
448 |
}
|
449 |
}
|
450 |
|
451 |
+
// 9. ๋ฒํผ ํด๋ฆญ ์ด๋ฒคํธ
|
452 |
document.querySelectorAll(".toggle-button").forEach(button => {
|
453 |
button.addEventListener("click", function() {
|
454 |
+
document.querySelectorAll(".toggle-button").forEach(b => b.classList.remove("active"));
|
455 |
this.classList.add("active");
|
456 |
updateSidebar(this.getAttribute("data-filter"));
|
457 |
});
|
458 |
});
|
459 |
|
460 |
+
// 10. ํ์ด์ง ๋ก๋ ์ All ํํฐ
|
461 |
updateSidebar("all");
|
462 |
</script>
|
463 |
</body>
|
464 |
+
</html>
|