openfree commited on
Commit
0447a88
ยท
verified ยท
1 Parent(s): 2de9c75

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +17 -27
index.html CHANGED
@@ -92,7 +92,7 @@
92
  <a href="https://discord.gg/openfreeai" target="_blank">Community</a>
93
  </div>
94
 
95
- <!-- ํ•„ํ„ฐ ๋ฒ„ํŠผ ์˜์—ญ (์นดํ…Œ๊ณ ๋ฆฌ๋ณ„) -->
96
  <div class="filter-group" id="filter-group">
97
  <!-- JavaScript๋กœ ๋™์ ์œผ๋กœ ๋ฒ„ํŠผ ์ƒ์„ฑ -->
98
  </div>
@@ -109,10 +109,8 @@
109
  </div>
110
 
111
  <script>
112
- // 1. ์ œ๊ณตํ•ด์ฃผ์‹  ์ „์ฒด ํ”„๋กœ์ ํŠธ ๋ฆฌ์ŠคํŠธ (ํ‚ค: ํ”„๋กœ์ ํŠธ ์ด๋ฆ„, ๊ฐ’: URL)
113
  const projectList = {
114
-
115
-
116
  "fantos/Panorama": "https://huggingface.co/spaces/fantos/Panorama",
117
  "ginigen/Multi-LoRAgen": "https://huggingface.co/spaces/ginigen/Multi-LoRAgen",
118
  "ginigen/canvas-studio": "https://huggingface.co/spaces/ginigen/canvas-studio",
@@ -231,30 +229,30 @@
231
  "aiqtech/FLUX-Ghibli-Studio-LoRA": "https://huggingface.co/spaces/aiqtech/FLUX-Ghibli-Studio-LoRA",
232
  "aiqtech/flxgif": "https://huggingface.co/spaces/aiqtech/flxgif",
233
  "aiqtech/imaginpaint": "https://huggingface.co/spaces/aiqtech/imaginpaint"
234
-
235
  };
236
 
237
  // 2. URL ๋ณ€ํ™˜ ํ•จ์ˆ˜: "https://huggingface.co/spaces/{namespace}/{project}" โ†’ "https://{namespace}-{project}.hf.space"
238
  function transformUrl(url) {
239
  const prefix = "https://huggingface.co/spaces/";
240
  if (url.startsWith(prefix)) {
241
- const rest = url.substring(prefix.length); // ์˜ˆ: "fantos/VoiceClone"
242
- // ๋‹จ, key์— ์žˆ๋Š” "/"๋Š” ํ•˜์ดํ”ˆ(-)์œผ๋กœ ๋ณ€๊ฒฝ
243
  return "https://" + rest.replace("/", "-") + ".hf.space";
244
  }
245
  return url;
246
  }
247
 
248
- // 3. ํ”„๋กœ์ ํŠธ ๋ฆฌ์ŠคํŠธ ๋ฐฐ์—ด๋กœ ๋ณ€ํ™˜: ๊ฐ ํ•ญ๋ชฉ { name, url, category }
249
- const projects = Object.keys(projectList).map(key => {
 
 
250
  return {
251
- name: key, // ์˜ˆ: "ginigen/Multi-LoRAgen"
252
  url: transformUrl(projectList[key]),
253
- category: key.split("/")[0] // ์นดํ…Œ๊ณ ๋ฆฌ๋Š” "/" ์•ž๋ถ€๋ถ„, ์˜ˆ: "ginigen"
254
  };
255
  });
256
 
257
- // 4. ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„ ๊ทธ๋ฃนํ™” (์˜ˆ: { ginigen: [...], ginipick: [...], fantos: [...], fantaxy: [...], ... })
258
  const grouped = {};
259
  projects.forEach(project => {
260
  const cat = project.category;
@@ -264,16 +262,15 @@
264
  grouped[cat].push(project);
265
  });
266
 
267
- // 5. ํ•„ํ„ฐ ๋ฒ„ํŠผ(์นดํ…Œ๊ณ ๋ฆฌ) ๋™์  ์ƒ์„ฑ (๊ธฐ๋ณธ "All" ํฌํ•จ)
 
268
  const filterGroupDiv = document.getElementById("filter-group");
269
- // "All" ๋ฒ„ํŠผ ์ƒ์„ฑ
270
  const allButton = document.createElement("button");
271
  allButton.className = "toggle-button active";
272
  allButton.setAttribute("data-filter", "all");
273
  allButton.textContent = "All";
274
  filterGroupDiv.appendChild(allButton);
275
- // ๊ทธ๋ฃนํ™”๋œ ๊ฐ ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„ ๋ฒ„ํŠผ ์ƒ์„ฑ (์ •๋ ฌํ•˜์—ฌ ํ‘œ์‹œ)
276
- Object.keys(grouped).sort().forEach(category => {
277
  const btn = document.createElement("button");
278
  btn.className = "toggle-button";
279
  btn.setAttribute("data-filter", category);
@@ -281,16 +278,11 @@
281
  filterGroupDiv.appendChild(btn);
282
  });
283
 
284
- // 6. ์‚ฌ์ด๋“œ๋ฐ” ์—…๋ฐ์ดํŠธ ํ•จ์ˆ˜: ์„ ํƒํ•œ ํ•„ํ„ฐ์˜ ๋ชจ๋“  ํ•ญ๋ชฉ ์ถœ๋ ฅ
285
  function updateSidebar(filter) {
286
  const sidebar = document.getElementById("sidebar");
287
- sidebar.innerHTML = ""; // ๊ธฐ์กด ํ•ญ๋ชฉ ์ดˆ๊ธฐํ™”
288
- let items = [];
289
- if (filter === "all") {
290
- items = projects;
291
- } else {
292
- items = grouped[filter] || [];
293
- }
294
  const ul = document.createElement("ul");
295
  items.forEach(item => {
296
  const li = document.createElement("li");
@@ -301,7 +293,6 @@
301
  ul.appendChild(li);
302
  });
303
  sidebar.appendChild(ul);
304
- // ๊ธฐ๋ณธ์œผ๋กœ ์ฒซ ๋ฒˆ์งธ ํ•ญ๋ชฉ ๋กœ๋“œ (์žˆ์œผ๋ฉด)
305
  if (items.length > 0) {
306
  document.getElementById("embed-frame").setAttribute("src", items[0].url);
307
  } else {
@@ -314,8 +305,7 @@
314
  button.addEventListener("click", function() {
315
  document.querySelectorAll(".toggle-button").forEach(btn => btn.classList.remove("active"));
316
  this.classList.add("active");
317
- const filter = this.getAttribute("data-filter");
318
- updateSidebar(filter);
319
  });
320
  });
321
 
 
92
  <a href="https://discord.gg/openfreeai" target="_blank">Community</a>
93
  </div>
94
 
95
+ <!-- ํ•„ํ„ฐ ๋ฒ„ํŠผ ์˜์—ญ (๋ฏธ๋ฆฌ ์ •์˜ํ•œ 10๊ฐ€์ง€ ๊ทธ๋ฃน ์‚ฌ์šฉ) -->
96
  <div class="filter-group" id="filter-group">
97
  <!-- JavaScript๋กœ ๋™์ ์œผ๋กœ ๋ฒ„ํŠผ ์ƒ์„ฑ -->
98
  </div>
 
109
  </div>
110
 
111
  <script>
112
+ // 1. ์ œ๊ณต๋œ ์ „์ฒด ํ”„๋กœ์ ํŠธ ๋ฆฌ์ŠคํŠธ (ํ‚ค: ํ”„๋กœ์ ํŠธ ์ด๋ฆ„, ๊ฐ’: URL)
113
  const projectList = {
 
 
114
  "fantos/Panorama": "https://huggingface.co/spaces/fantos/Panorama",
115
  "ginigen/Multi-LoRAgen": "https://huggingface.co/spaces/ginigen/Multi-LoRAgen",
116
  "ginigen/canvas-studio": "https://huggingface.co/spaces/ginigen/canvas-studio",
 
229
  "aiqtech/FLUX-Ghibli-Studio-LoRA": "https://huggingface.co/spaces/aiqtech/FLUX-Ghibli-Studio-LoRA",
230
  "aiqtech/flxgif": "https://huggingface.co/spaces/aiqtech/flxgif",
231
  "aiqtech/imaginpaint": "https://huggingface.co/spaces/aiqtech/imaginpaint"
 
232
  };
233
 
234
  // 2. URL ๋ณ€ํ™˜ ํ•จ์ˆ˜: "https://huggingface.co/spaces/{namespace}/{project}" โ†’ "https://{namespace}-{project}.hf.space"
235
  function transformUrl(url) {
236
  const prefix = "https://huggingface.co/spaces/";
237
  if (url.startsWith(prefix)) {
238
+ const rest = url.substring(prefix.length);
 
239
  return "https://" + rest.replace("/", "-") + ".hf.space";
240
  }
241
  return url;
242
  }
243
 
244
+ // 3. ๋ชจ๋“  ํ•ญ๋ชฉ์˜ ์นดํ…Œ๊ณ ๋ฆฌ๋ฅผ ๊ฐ•์ œ๋กœ "Image Gen"์œผ๋กœ ์ง€์ •ํ•˜๊ณ , ์ด๋ฆ„์„ "Image Gen/ํ”„๋กœ์ ํŠธ๋ช…" ํ˜•ํƒœ๋กœ ๋ณ€๊ฒฝ
245
+ const keys = Object.keys(projectList);
246
+ const projects = keys.map((key) => {
247
+ const projectName = key.split("/").slice(1).join("/");
248
  return {
249
+ name: "Image Gen/" + projectName,
250
  url: transformUrl(projectList[key]),
251
+ category: "Image Gen"
252
  };
253
  });
254
 
255
+ // 4. (ํ˜„์žฌ ๋ชจ๋“  ํ•ญ๋ชฉ์ด "Image Gen"์ด์ง€๋งŒ) ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„ ๊ทธ๋ฃนํ™”
256
  const grouped = {};
257
  projects.forEach(project => {
258
  const cat = project.category;
 
262
  grouped[cat].push(project);
263
  });
264
 
265
+ // 5. ํ•„ํ„ฐ ๋ฒ„ํŠผ์€ ๋ฏธ๋ฆฌ ์ •์˜ํ•œ 10๊ฐ€์ง€ ๊ทธ๋ฃน์œผ๋กœ ์ƒ์„ฑ (NEW, BEST, Text, Image Gen, Image Edit, Audio, Video, Productivity, Utility, Vision)
266
+ const fixedGroups = ["NEW", "BEST", "Text", "Image Gen", "Image Edit", "Audio", "Video", "Productivity", "Utility", "Vision"];
267
  const filterGroupDiv = document.getElementById("filter-group");
 
268
  const allButton = document.createElement("button");
269
  allButton.className = "toggle-button active";
270
  allButton.setAttribute("data-filter", "all");
271
  allButton.textContent = "All";
272
  filterGroupDiv.appendChild(allButton);
273
+ fixedGroups.forEach(category => {
 
274
  const btn = document.createElement("button");
275
  btn.className = "toggle-button";
276
  btn.setAttribute("data-filter", category);
 
278
  filterGroupDiv.appendChild(btn);
279
  });
280
 
281
+ // 6. ์‚ฌ์ด๋“œ๋ฐ” ์—…๋ฐ์ดํŠธ ํ•จ์ˆ˜: ์„ ํƒํ•œ ํ•„ํ„ฐ์˜ ํ•ญ๋ชฉ ์ถœ๋ ฅ
282
  function updateSidebar(filter) {
283
  const sidebar = document.getElementById("sidebar");
284
+ sidebar.innerHTML = "";
285
+ let items = (filter === "all") ? projects : projects.filter(project => project.category === filter);
 
 
 
 
 
286
  const ul = document.createElement("ul");
287
  items.forEach(item => {
288
  const li = document.createElement("li");
 
293
  ul.appendChild(li);
294
  });
295
  sidebar.appendChild(ul);
 
296
  if (items.length > 0) {
297
  document.getElementById("embed-frame").setAttribute("src", items[0].url);
298
  } else {
 
305
  button.addEventListener("click", function() {
306
  document.querySelectorAll(".toggle-button").forEach(btn => btn.classList.remove("active"));
307
  this.classList.add("active");
308
+ updateSidebar(this.getAttribute("data-filter"));
 
309
  });
310
  });
311