Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,498 +1,562 @@
|
|
1 |
-
import
|
2 |
-
import
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
-
#
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
)
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
-
#
|
79 |
-
|
|
|
80 |
|
81 |
-
#
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
try:
|
97 |
-
# 로컬 LoRA 파일의 절대 경로 확인
|
98 |
-
current_dir = os.path.dirname(os.path.abspath(__file__))
|
99 |
-
lora_path = os.path.join(current_dir, "myt-flux-fantasy.safetensors")
|
100 |
|
101 |
-
|
102 |
-
|
|
|
103 |
|
104 |
-
|
|
|
|
|
105 |
|
106 |
-
|
107 |
-
pipe.load_lora_weights(lora_path)
|
108 |
-
pipe.fuse_lora(lora_scale=0.75) # lora_scale 값 조정
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
121 |
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
def add_text_to_image(
|
195 |
-
input_image,
|
196 |
-
text,
|
197 |
-
font_size,
|
198 |
-
color,
|
199 |
-
opacity,
|
200 |
-
x_position,
|
201 |
-
y_position,
|
202 |
-
thickness,
|
203 |
-
text_position_type,
|
204 |
-
font_choice
|
205 |
-
):
|
206 |
-
try:
|
207 |
-
if input_image is None or text.strip() == "":
|
208 |
-
return input_image
|
209 |
-
|
210 |
-
if not isinstance(input_image, Image.Image):
|
211 |
-
if isinstance(input_image, np.ndarray):
|
212 |
-
image = Image.fromarray(input_image)
|
213 |
-
else:
|
214 |
-
raise ValueError("Unsupported image type")
|
215 |
-
else:
|
216 |
-
image = input_image.copy()
|
217 |
-
|
218 |
-
if image.mode != 'RGBA':
|
219 |
-
image = image.convert('RGBA')
|
220 |
-
|
221 |
-
font_files = {
|
222 |
-
"Default": "DejaVuSans.ttf",
|
223 |
-
"Korean Regular": "ko-Regular.ttf"
|
224 |
-
}
|
225 |
-
|
226 |
-
try:
|
227 |
-
font_file = font_files.get(font_choice, "DejaVuSans.ttf")
|
228 |
-
font = ImageFont.truetype(font_file, int(font_size))
|
229 |
-
except Exception as e:
|
230 |
-
print(f"Font loading error ({font_choice}): {str(e)}")
|
231 |
-
font = ImageFont.load_default()
|
232 |
-
|
233 |
-
color_map = {
|
234 |
-
'White': (255, 255, 255),
|
235 |
-
'Black': (0, 0, 0),
|
236 |
-
'Red': (255, 0, 0),
|
237 |
-
'Green': (0, 255, 0),
|
238 |
-
'Blue': (0, 0, 255),
|
239 |
-
'Yellow': (255, 255, 0),
|
240 |
-
'Purple': (128, 0, 128)
|
241 |
-
}
|
242 |
-
rgb_color = color_map.get(color, (255, 255, 255))
|
243 |
-
|
244 |
-
temp_draw = ImageDraw.Draw(image)
|
245 |
-
text_bbox = temp_draw.textbbox((0, 0), text, font=font)
|
246 |
-
text_width = text_bbox[2] - text_bbox[0]
|
247 |
-
text_height = text_bbox[3] - text_bbox[1]
|
248 |
-
|
249 |
-
actual_x = int((image.width - text_width) * (x_position / 100))
|
250 |
-
actual_y = int((image.height - text_height) * (y_position / 100))
|
251 |
-
|
252 |
-
text_color = (*rgb_color, int(opacity))
|
253 |
-
|
254 |
-
txt_overlay = Image.new('RGBA', image.size, (255, 255, 255, 0))
|
255 |
-
draw = ImageDraw.Draw(txt_overlay)
|
256 |
-
|
257 |
-
add_text_with_stroke(
|
258 |
-
draw,
|
259 |
-
text,
|
260 |
-
actual_x,
|
261 |
-
actual_y,
|
262 |
-
font,
|
263 |
-
text_color,
|
264 |
-
int(thickness)
|
265 |
-
)
|
266 |
-
output_image = Image.alpha_composite(image, txt_overlay)
|
267 |
-
|
268 |
-
output_image = output_image.convert('RGB')
|
269 |
-
|
270 |
-
return output_image
|
271 |
-
|
272 |
-
except Exception as e:
|
273 |
-
print(f"Error in add_text_to_image: {str(e)}")
|
274 |
-
return input_image
|
275 |
-
|
276 |
-
|
277 |
-
css = """
|
278 |
-
footer {display: none}
|
279 |
-
.main-title {
|
280 |
-
text-align: center;
|
281 |
-
margin: 1em 0;
|
282 |
-
padding: 1.5em;
|
283 |
-
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
284 |
-
border-radius: 15px;
|
285 |
-
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
286 |
}
|
287 |
-
.main-title h1 {
|
288 |
-
color: #2196F3;
|
289 |
-
font-size: 2.8em;
|
290 |
-
margin-bottom: 0.3em;
|
291 |
-
font-weight: 700;
|
292 |
-
}
|
293 |
-
.main-title p {
|
294 |
-
color: #555;
|
295 |
-
font-size: 1.3em;
|
296 |
-
line-height: 1.4;
|
297 |
-
}
|
298 |
-
.container {
|
299 |
-
max-width: 1200px;
|
300 |
-
margin: auto;
|
301 |
-
padding: 20px;
|
302 |
-
}
|
303 |
-
.input-panel, .output-panel {
|
304 |
-
background: white;
|
305 |
-
padding: 1.5em;
|
306 |
-
border-radius: 12px;
|
307 |
-
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
|
308 |
-
margin-bottom: 1em;
|
309 |
-
}
|
310 |
-
"""
|
311 |
-
|
312 |
-
import requests
|
313 |
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
"masterpiece, best quality, highly detailed",
|
320 |
-
"anime style, animation style",
|
321 |
-
"vibrant colors, perfect lighting",
|
322 |
-
"professional composition",
|
323 |
-
"dynamic pose, expressive features",
|
324 |
-
"detailed background, perfect shadows",
|
325 |
-
"[trigger]"
|
326 |
-
]
|
327 |
-
|
328 |
-
# 애니메이션 스타일 프롬프트 변환
|
329 |
-
anime_style_prompt = f"an animated {prompt}, detailed anime art style"
|
330 |
-
|
331 |
-
# 최종 프롬프트 구성
|
332 |
-
final_prompt = f"{anime_style_prompt}, {', '.join(enhancements)}"
|
333 |
-
print(f"Enhanced prompt: {final_prompt}")
|
334 |
-
|
335 |
-
return final_prompt
|
336 |
-
except Exception as e:
|
337 |
-
print(f"Prompt enhancement failed: {str(e)}")
|
338 |
-
return prompt
|
339 |
-
|
340 |
-
# 기존의 pipeline 초기화 부분 제거
|
341 |
-
# try:
|
342 |
-
# prompt_enhancer = pipeline(...)
|
343 |
-
# except Exception as e:
|
344 |
-
# print(f"Error initializing prompt enhancer: {str(e)}")
|
345 |
-
# prompt_enhancer = None
|
346 |
-
|
347 |
-
|
348 |
-
with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
349 |
-
gr.HTML("""
|
350 |
-
<div class="main-title">
|
351 |
-
<h1>🎨 Webtoon Studio</h1>
|
352 |
-
<p>Generate webtoon-style images and add text with various styles and positions.</p>
|
353 |
-
</div>
|
354 |
-
""")
|
355 |
-
|
356 |
-
with gr.Row():
|
357 |
-
with gr.Column(scale=1):
|
358 |
-
gen_prompt = gr.Textbox(
|
359 |
-
label="Generation Prompt",
|
360 |
-
placeholder="Enter your image generation prompt..."
|
361 |
-
)
|
362 |
-
enhance_btn = gr.Button("✨ Enhance Prompt", variant="secondary")
|
363 |
-
|
364 |
-
with gr.Row():
|
365 |
-
gen_width = gr.Slider(512, 1024, 768, step=64, label="Width")
|
366 |
-
gen_height = gr.Slider(512, 1024, 768, step=64, label="Height")
|
367 |
-
|
368 |
-
with gr.Row():
|
369 |
-
guidance_scale = gr.Slider(1, 20, 7.5, step=0.5, label="Guidance Scale")
|
370 |
-
num_steps = gr.Slider(1, 50, 30, step=1, label="Number of Steps")
|
371 |
-
|
372 |
-
with gr.Row():
|
373 |
-
seed = gr.Number(label="Seed", value=-1)
|
374 |
-
randomize_seed = gr.Checkbox(label="Randomize Seed", value=True)
|
375 |
-
|
376 |
-
generate_btn = gr.Button("Generate Image", variant="primary")
|
377 |
-
|
378 |
-
output_image = gr.Image(
|
379 |
-
label="Generated Image",
|
380 |
-
type="pil",
|
381 |
-
show_download_button=True
|
382 |
-
)
|
383 |
-
output_seed = gr.Number(label="Used Seed", interactive=False)
|
384 |
-
|
385 |
-
# 텍스트 추가 섹션
|
386 |
-
with gr.Accordion("Text Options", open=False):
|
387 |
-
text_input = gr.Textbox(
|
388 |
-
label="Text Content",
|
389 |
-
placeholder="Enter text to add..."
|
390 |
-
)
|
391 |
-
text_position_type = gr.Radio(
|
392 |
-
choices=["Text Over Image"],
|
393 |
-
value="Text Over Image",
|
394 |
-
label="Text Position",
|
395 |
-
visible=True
|
396 |
-
)
|
397 |
-
with gr.Row():
|
398 |
-
font_choice = gr.Dropdown(
|
399 |
-
choices=["Default", "Korean Regular"],
|
400 |
-
value="Default",
|
401 |
-
label="Font Selection",
|
402 |
-
interactive=True
|
403 |
-
)
|
404 |
-
font_size = gr.Slider(
|
405 |
-
minimum=10,
|
406 |
-
maximum=200,
|
407 |
-
value=40,
|
408 |
-
step=5,
|
409 |
-
label="Font Size"
|
410 |
-
)
|
411 |
-
with gr.Row():
|
412 |
-
color_dropdown = gr.Dropdown(
|
413 |
-
choices=["White", "Black", "Red", "Green", "Blue", "Yellow", "Purple"],
|
414 |
-
value="White",
|
415 |
-
label="Text Color"
|
416 |
-
)
|
417 |
-
thickness = gr.Slider(
|
418 |
-
minimum=0,
|
419 |
-
maximum=10,
|
420 |
-
value=1,
|
421 |
-
step=1,
|
422 |
-
label="Text Thickness"
|
423 |
-
)
|
424 |
-
with gr.Row():
|
425 |
-
opacity_slider = gr.Slider(
|
426 |
-
minimum=0,
|
427 |
-
maximum=255,
|
428 |
-
value=255,
|
429 |
-
step=1,
|
430 |
-
label="Opacity"
|
431 |
-
)
|
432 |
-
with gr.Row():
|
433 |
-
x_position = gr.Slider(
|
434 |
-
minimum=0,
|
435 |
-
maximum=100,
|
436 |
-
value=50,
|
437 |
-
step=1,
|
438 |
-
label="Left(0%)~Right(100%)"
|
439 |
-
)
|
440 |
-
y_position = gr.Slider(
|
441 |
-
minimum=0,
|
442 |
-
maximum=100,
|
443 |
-
value=50,
|
444 |
-
step=1,
|
445 |
-
label="High(0%)~Low(100%)"
|
446 |
-
)
|
447 |
-
add_text_btn = gr.Button("Apply Text", variant="primary")
|
448 |
-
|
449 |
-
# 이벤트 바인딩
|
450 |
-
generate_btn.click(
|
451 |
-
fn=generate_image,
|
452 |
-
inputs=[
|
453 |
-
gen_prompt,
|
454 |
-
seed,
|
455 |
-
randomize_seed,
|
456 |
-
gen_width,
|
457 |
-
gen_height,
|
458 |
-
guidance_scale,
|
459 |
-
num_steps,
|
460 |
-
],
|
461 |
-
outputs=[output_image, output_seed]
|
462 |
-
)
|
463 |
-
|
464 |
-
add_text_btn.click(
|
465 |
-
fn=add_text_to_image,
|
466 |
-
inputs=[
|
467 |
-
output_image,
|
468 |
-
text_input,
|
469 |
-
font_size,
|
470 |
-
color_dropdown,
|
471 |
-
opacity_slider,
|
472 |
-
x_position,
|
473 |
-
y_position,
|
474 |
-
thickness,
|
475 |
-
text_position_type,
|
476 |
-
font_choice
|
477 |
-
],
|
478 |
-
outputs=output_image
|
479 |
-
)
|
480 |
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
491 |
|
492 |
-
|
493 |
-
|
494 |
-
server_name="0.0.0.0",
|
495 |
-
server_port=7860,
|
496 |
-
share=False,
|
497 |
-
max_threads=2
|
498 |
-
)
|
|
|
1 |
+
from flask import Flask, render_template, request, jsonify
|
2 |
+
import os, re, json
|
3 |
+
|
4 |
+
app = Flask(__name__)
|
5 |
+
|
6 |
+
# ────────────────────────── 1. CONFIGURATION ──────────────────────────
|
7 |
+
|
8 |
+
# Domains that commonly block iframes
|
9 |
+
BLOCKED_DOMAINS = [
|
10 |
+
"naver.com", "daum.net", "google.com",
|
11 |
+
"facebook.com", "instagram.com", "kakao.com",
|
12 |
+
"ycombinator.com"
|
13 |
+
]
|
14 |
+
|
15 |
+
# ────────────────────────── 2. CURATED CATEGORIES ──────────────────────────
|
16 |
+
CATEGORIES = {
|
17 |
+
"Popular": [
|
18 |
+
"https://huggingface.co/spaces/openfree/AGI-Screenplay",
|
19 |
+
"https://huggingface.co/spaces/openfree/AGI-WebNovel",
|
20 |
+
"https://huggingface.co/spaces/openfree/AGI-NOVEL",
|
21 |
+
"https://huggingface.co/spaces/fantaxy/AGI-LEADERBOARD",
|
22 |
+
"https://cutechicken-3d-airforce-simulator.static.hf.space",
|
23 |
+
"https://huggingface.co/spaces/ginipick/Private-AI",
|
24 |
+
"https://huggingface.co/spaces/fantaxy/ofai-flx-logo",
|
25 |
+
"https://huggingface.co/spaces/aiqtech/FLUX-Ghibli-Studio-LoRA",
|
26 |
+
"https://huggingface.co/spaces/seawolf2357/REALVISXL-V5",
|
27 |
+
"https://huggingface.co/spaces/fantos/flx8lora",
|
28 |
+
"https://huggingface.co/spaces/ginipick/Realtime-FLUX",
|
29 |
+
"https://huggingface.co/spaces/fantaxy/flx-pulid",
|
30 |
+
"https://huggingface.co/spaces/ginipick/FLUX-Prompt-Generator",
|
31 |
+
"https://huggingface.co/spaces/aiqtech/kofaceid",
|
32 |
+
"https://huggingface.co/spaces/aiqtech/flxgif",
|
33 |
+
"https://huggingface.co/spaces/fantos/flxfashmodel",
|
34 |
+
"https://huggingface.co/spaces/fantos/flxcontrol",
|
35 |
+
"https://huggingface.co/spaces/fantos/textcutobject",
|
36 |
+
"https://huggingface.co/spaces/seawolf2357/flxloraexp",
|
37 |
+
"https://huggingface.co/spaces/fantaxy/flxloraexp",
|
38 |
+
"https://huggingface.co/spaces/aiqtech/imaginpaint",
|
39 |
+
"https://huggingface.co/spaces/ginipick/FLUXllama",
|
40 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored",
|
41 |
+
"https://huggingface.co/spaces/fantaxy/flx-upscale",
|
42 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-video",
|
43 |
+
"https://huggingface.co/spaces/fantos/VoiceClone",
|
44 |
+
"https://huggingface.co/spaces/fantaxy/Rolls-Royce",
|
45 |
+
"https://huggingface.co/spaces/aiqtech/FLUX-military",
|
46 |
+
"https://huggingface.co/spaces/fantaxy/FLUX-Animations",
|
47 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-video2",
|
48 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-photo",
|
49 |
+
"https://huggingface.co/spaces/ginipick/Time-Stream",
|
50 |
+
"https://huggingface.co/spaces/seawolf2357/sd-prompt-gen",
|
51 |
+
"https://huggingface.co/spaces/openfree/MagicFace-V3",
|
52 |
+
"https://huggingface.co/spaces/Heartsync/adult",
|
53 |
+
"https://huggingface.co/spaces/Heartsync/wan2-1-fast-security",
|
54 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-REAL",
|
55 |
+
"https://huggingface.co/spaces/seawolf2357/img2vid",
|
56 |
+
"https://huggingface.co/spaces/openfree/image-to-vector",
|
57 |
+
"https://huggingface.co/spaces/openfree/DreamO-video",
|
58 |
+
"https://huggingface.co/spaces/VIDraft/FramePack_rotate_landscape",
|
59 |
+
"https://huggingface.co/spaces/fantaxy/Sound-AI-SFX",
|
60 |
+
"https://huggingface.co/spaces/ginigen/VoiceClone-TTS",
|
61 |
+
"https://huggingface.co/spaces/Heartsync/FREE-NSFW-HUB",
|
62 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-image",
|
63 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-detection",
|
64 |
+
"https://huggingface.co/spaces/Heartsync/VEO3-RealTime",
|
65 |
+
"https://huggingface.co/spaces/ginigen/VEO3-Free",
|
66 |
+
"https://huggingface.co/spaces/ginigen/FLUX-Text-Tree-Image",
|
67 |
+
"https://huggingface.co/spaces/ginigen/text3d-r1",
|
68 |
+
"https://huggingface.co/spaces/VIDraft/stable-diffusion-3.5-large-turboX",
|
69 |
+
|
70 |
+
],
|
71 |
+
"BEST": [
|
72 |
+
"https://huggingface.co/spaces/MaziyarPanahi/FACTS-Leaderboard",
|
73 |
+
"https://huggingface.co/spaces/ginigen/Flux-Kontext-Style",
|
74 |
+
"https://huggingface.co/spaces/openfree/Cycle-Navigator",
|
75 |
+
"https://huggingface.co/spaces/ginigen/Flux-Kontext-FaceLORA",
|
76 |
+
"https://huggingface.co/spaces/ginigen/Seedance-Free",
|
77 |
+
"https://huggingface.co/spaces/VIDraft/SOMA-AGI",
|
78 |
+
"https://huggingface.co/spaces/aiqtech/Heatmap-Leaderboard",
|
79 |
+
"https://huggingface.co/spaces/VIDraft/DNA-CASINO",
|
80 |
+
"https://huggingface.co/spaces/aiqtech/SOMA-Oriental",
|
81 |
+
"https://huggingface.co/spaces/fantaxy/YTB-TEST",
|
82 |
+
"https://huggingface.co/spaces/aiqtech/Contributors-Leaderboard",
|
83 |
+
"https://huggingface.co/spaces/ginigen/text3d-r1",
|
84 |
+
"https://huggingface.co/spaces/VIDraft/stable-diffusion-3.5-large-turboX",
|
85 |
+
"https://huggingface.co/spaces/openfree/Korean-Leaderboard",
|
86 |
+
"https://huggingface.co/spaces/fantos/flxcontrol",
|
87 |
+
"https://huggingface.co/spaces/aiqtech/FLUX-Ghibli-Studio-LoRA",
|
88 |
+
"https://huggingface.co/spaces/openfree/AI-Podcast",
|
89 |
+
"https://huggingface.co/spaces/ginigen/Workflow-Canvas",
|
90 |
+
"https://huggingface.co/spaces/ginigen/3D-LLAMA",
|
91 |
+
"https://huggingface.co/spaces/ginigen/VoiceClone-TTS",
|
92 |
+
"https://huggingface.co/spaces/VIDraft/ACE-Singer",
|
93 |
+
"https://huggingface.co/spaces/ginipick/AI-BOOK",
|
94 |
+
"https://huggingface.co/spaces/immunobiotech/drug-discovery",
|
95 |
+
"https://huggingface.co/spaces/VIDraft/Robo-Beam",
|
96 |
+
"https://huggingface.co/spaces/fantaxy/fantasy-novel",
|
97 |
+
"https://huggingface.co/spaces/immunobiotech/Gemini-MICHELIN",
|
98 |
+
"https://huggingface.co/spaces/openfree/Chart-GPT",
|
99 |
+
"https://huggingface.co/spaces/ginipick/NH-Korea",
|
100 |
+
"https://huggingface.co/spaces/VIDraft/Voice-Clone-Podcast",
|
101 |
+
"https://huggingface.co/spaces/ginipick/Private-AI",
|
102 |
+
"https://huggingface.co/spaces/ginigen/Flux-VIDEO",
|
103 |
+
"https://huggingface.co/spaces/openfree/open-GAMMA",
|
104 |
+
"https://huggingface.co/spaces/ginipick/PharmAI-Korea",
|
105 |
+
"https://huggingface.co/spaces/ginipick/Pharmacy",
|
106 |
+
"https://huggingface.co/spaces/ginipick/PDF-EXAM",
|
107 |
+
"https://huggingface.co/spaces/ginipick/IDEA-DESIGN",
|
108 |
+
"https://huggingface.co/spaces/openfree/DreamO-video",
|
109 |
+
"https://huggingface.co/spaces/ginipick/10m-marketing",
|
110 |
+
"https://huggingface.co/spaces/VIDraft/voice-trans",
|
111 |
+
"https://huggingface.co/spaces/VIDraft/NH-Prediction",
|
112 |
+
"https://huggingface.co/spaces/fantos/flx8lora",
|
113 |
+
"https://huggingface.co/spaces/ginigen/MagicFace-V3",
|
114 |
+
"https://huggingface.co/spaces/openfree/Live-Podcast",
|
115 |
+
"https://huggingface.co/spaces/seawolf2357/ocrlatex",
|
116 |
+
"https://huggingface.co/spaces/Heartsync/VEO3-RealTime",
|
117 |
+
"https://huggingface.co/spaces/ginigen/VEO3-Free",
|
118 |
+
"https://huggingface.co/spaces/openfree/MagicFace-V3",
|
119 |
+
"https://huggingface.co/spaces/aiqtech/FLUX-military",
|
120 |
+
"https://huggingface.co/spaces/fantaxy/flxloraexp",
|
121 |
+
"https://huggingface.co/spaces/Heartsync/WAN2-1-fast-T2V-FusioniX",
|
122 |
+
"https://huggingface.co/spaces/ginigen/FLUXllama-Multilingual",
|
123 |
+
"https://huggingface.co/spaces/Heartsync/wan2-1-fast-security",
|
124 |
+
"https://huggingface.co/spaces/fantaxy/Rolls-Royce",
|
125 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-REAL",
|
126 |
+
"https://huggingface.co/spaces/ginipick/Realtime-FLUX",
|
127 |
+
"https://huggingface.co/spaces/aiqtech/imaginpaint",
|
128 |
+
"https://huggingface.co/spaces/aiqtech/flxgif",
|
129 |
+
"https://huggingface.co/spaces/fantos/flxfashmodel",
|
130 |
+
"https://huggingface.co/spaces/aiqtech/kofaceid",
|
131 |
+
"https://huggingface.co/spaces/ginipick/FLUX-Prompt-Generator",
|
132 |
+
"https://huggingface.co/spaces/seawolf2357/REALVISXL-V5",
|
133 |
+
"https://huggingface.co/spaces/fantaxy/FLUX-Animations",
|
134 |
+
"https://huggingface.co/spaces/fantaxy/flx-pulid",
|
135 |
+
"https://huggingface.co/spaces/fantaxy/ofai-flx-logo",
|
136 |
+
"https://huggingface.co/spaces/openfree/image-to-vector",
|
137 |
+
"https://huggingface.co/spaces/Heartsync/FREE-NSFW-HUB",
|
138 |
+
"https://huggingface.co/spaces/seawolf2357/sd-prompt-gen",
|
139 |
+
"https://huggingface.co/spaces/VIDraft/FramePack_rotate_landscape",
|
140 |
+
"https://huggingface.co/spaces/ginipick/FLUXllama",
|
141 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-image",
|
142 |
+
"https://huggingface.co/spaces/seawolf2357/img2vid",
|
143 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-video2",
|
144 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-detection",
|
145 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-video",
|
146 |
+
"https://huggingface.co/spaces/Heartsync/adult",
|
147 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored",
|
148 |
+
"https://huggingface.co/spaces/fantos/VoiceClone",
|
149 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-photo",
|
150 |
+
"https://huggingface.co/spaces/fantaxy/flx-upscale",
|
151 |
+
"https://huggingface.co/spaces/seawolf2357/flxloraexp",
|
152 |
+
"https://huggingface.co/spaces/ginipick/Time-Stream",
|
153 |
+
"https://huggingface.co/spaces/fantos/textcutobject",
|
154 |
+
|
155 |
+
|
156 |
+
],
|
157 |
+
"NEW": [
|
158 |
+
"https://huggingface.co/spaces/ginigen/Flux-Kontext-Style",
|
159 |
+
"https://cutechicken-3d-airforce-simulator.static.hf.space",
|
160 |
+
"https://huggingface.co/spaces/ginipick/Private-AI",
|
161 |
+
"https://huggingface.co/spaces/VIDraft/ACE-Singer",
|
162 |
+
"https://huggingface.co/spaces/ginipick/AI-BOOK",
|
163 |
+
"https://huggingface.co/spaces/openfree/Best-AI",
|
164 |
+
"https://huggingface.co/spaces/aiqtech/Heatmap-Leaderboard",
|
165 |
+
"https://huggingface.co/spaces/VIDraft/DNA-CASINO",
|
166 |
+
"https://huggingface.co/spaces/openfree/AGI-Screenplay",
|
167 |
+
"https://huggingface.co/spaces/openfree/AGI-WebNovel",
|
168 |
+
"https://huggingface.co/spaces/openfree/AGI-NOVEL",
|
169 |
+
"https://huggingface.co/spaces/fantaxy/AGI-LEADERBOARD",
|
170 |
+
"https://huggingface.co/spaces/ginigen/Seedance-Free",
|
171 |
+
"https://huggingface.co/spaces/aiqtech/SOMA-Oriental",
|
172 |
+
"https://huggingface.co/spaces/ginigen/Flux-Kontext-FaceLORA",
|
173 |
+
"https://huggingface.co/spaces/VIDraft/SOMA-AGI",
|
174 |
+
"https://huggingface.co/spaces/Heartsync/VEO3-RealTime",
|
175 |
+
"https://huggingface.co/spaces/openfree/Open-GAMMA",
|
176 |
+
"https://huggingface.co/spaces/ginigen/VEO3-Free",
|
177 |
+
"https://huggingface.co/spaces/Heartsync/WAN2-1-fast-T2V-FusioniX",
|
178 |
+
"https://huggingface.co/spaces/VIDraft/voice-trans",
|
179 |
+
"https://huggingface.co/spaces/VIDraft/Robo-Beam",
|
180 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-REAL",
|
181 |
+
"https://huggingface.co/spaces/fantaxy/fantasy-novel",
|
182 |
+
"https://huggingface.co/spaces/openfree/Chart-GPT",
|
183 |
+
"https://huggingface.co/spaces/Heartsync/Novel-NSFW",
|
184 |
+
"https://huggingface.co/spaces/ginigen/FLUX-Ghibli-LoRA2",
|
185 |
+
"https://huggingface.co/spaces/Heartsync/WAN-VIDEO-AUDIO",
|
186 |
+
"https://huggingface.co/spaces/Heartsync/wan2-1-fast-security",
|
187 |
+
"https://huggingface.co/spaces/ginigen/Flux-VIDEO",
|
188 |
+
"https://huggingface.co/spaces/aiqcamp/REMOVAL-TEXT-IMAGE",
|
189 |
+
"https://huggingface.co/spaces/VIDraft/Mistral-RAG-BitSix",
|
190 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-video2",
|
191 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-video",
|
192 |
+
"https://huggingface.co/spaces/fantaxy/YTB-TEST",
|
193 |
+
"https://huggingface.co/spaces/Heartsync/FREE-NSFW-HUB",
|
194 |
+
"https://huggingface.co/spaces/Heartsync/adult",
|
195 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-photo",
|
196 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored",
|
197 |
+
"https://huggingface.co/spaces/openfree/Live-Podcast",
|
198 |
+
"https://huggingface.co/spaces/openfree/AI-Podcast",
|
199 |
+
"https://huggingface.co/spaces/ginipick/NH-Korea",
|
200 |
+
"https://huggingface.co/spaces/VIDraft/NH-Prediction",
|
201 |
+
"https://huggingface.co/spaces/VIDraft/Voice-Clone-Podcast",
|
202 |
+
"https://huggingface.co/spaces/ginipick/PDF-EXAM",
|
203 |
+
"https://huggingface.co/spaces/openfree/Game-Gallery",
|
204 |
+
"https://huggingface.co/spaces/openfree/Vibe-Game",
|
205 |
+
"https://huggingface.co/spaces/ginipick/IDEA-DESIGN",
|
206 |
+
"https://huggingface.co/spaces/openfree/Cycle-Navigator",
|
207 |
+
"https://huggingface.co/spaces/openfree/DreamO-video",
|
208 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-detection",
|
209 |
+
|
210 |
+
|
211 |
+
],
|
212 |
+
"Productivity": [
|
213 |
+
"https://huggingface.co/spaces/aiqtech/Heatmap-Leaderboard",
|
214 |
+
"https://huggingface.co/spaces/VIDraft/DNA-CASINO",
|
215 |
+
"https://huggingface.co/spaces/openfree/Open-GAMMA",
|
216 |
+
"https://huggingface.co/spaces/VIDraft/Robo-Beam",
|
217 |
+
"https://huggingface.co/spaces/VIDraft/voice-trans",
|
218 |
+
"https://huggingface.co/spaces/Heartsync/FREE-NSFW-HUB",
|
219 |
+
"https://huggingface.co/spaces/openfree/Chart-GPT",
|
220 |
+
"https://huggingface.co/spaces/ginipick/AI-BOOK",
|
221 |
+
"https://huggingface.co/spaces/VIDraft/Voice-Clone-Podcast",
|
222 |
+
"https://huggingface.co/spaces/ginipick/PDF-EXAM",
|
223 |
+
"https://huggingface.co/spaces/ginigen/perflexity-clone",
|
224 |
+
"https://huggingface.co/spaces/ginipick/IDEA-DESIGN",
|
225 |
+
"https://huggingface.co/spaces/ginipick/10m-marketing",
|
226 |
+
"https://huggingface.co/spaces/openfree/Live-Podcast",
|
227 |
+
"https://huggingface.co/spaces/openfree/AI-Podcast",
|
228 |
+
"https://huggingface.co/spaces/ginipick/QR-Canvas-plus",
|
229 |
+
"https://huggingface.co/spaces/openfree/Badge",
|
230 |
+
"https://huggingface.co/spaces/VIDraft/mouse-webgen",
|
231 |
+
"https://huggingface.co/spaces/openfree/Vibe-Game",
|
232 |
+
"https://huggingface.co/spaces/VIDraft/NH-Prediction",
|
233 |
+
"https://huggingface.co/spaces/ginipick/NH-Korea",
|
234 |
+
"https://huggingface.co/spaces/openfree/Naming",
|
235 |
+
"https://huggingface.co/spaces/ginipick/Change-Hair",
|
236 |
+
],
|
237 |
+
"Multimodal": [
|
238 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-photo",
|
239 |
+
"https://huggingface.co/spaces/fantaxy/YTB-TEST",
|
240 |
+
"https://huggingface.co/spaces/ginigen/Seedance-Free",
|
241 |
+
"https://huggingface.co/spaces/Heartsync/VEO3-RealTime",
|
242 |
+
"https://huggingface.co/spaces/ginigen/VEO3-Free",
|
243 |
+
"https://huggingface.co/spaces/ginigen/VEO3-Directors",
|
244 |
+
"https://huggingface.co/spaces/Heartsync/WAN2-1-fast-T2V-FusioniX",
|
245 |
+
"https://huggingface.co/spaces/Heartsync/adult",
|
246 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored",
|
247 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-video2",
|
248 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-video",
|
249 |
+
"https://huggingface.co/spaces/Heartsync/WAN-VIDEO-AUDIO",
|
250 |
+
"https://huggingface.co/spaces/Heartsync/wan2-1-fast-security",
|
251 |
+
"https://huggingface.co/spaces/ginigen/Flux-VIDEO",
|
252 |
+
"https://huggingface.co/spaces/ginigen/3D-LLAMA-V1",
|
253 |
+
"https://huggingface.co/spaces/ginigen/Flux-VIDEO",
|
254 |
+
"https://huggingface.co/spaces/openfree/Multilingual-TTS",
|
255 |
+
"https://huggingface.co/spaces/VIDraft/ACE-Singer",
|
256 |
+
"https://huggingface.co/spaces/openfree/DreamO-video",
|
257 |
+
"https://huggingface.co/spaces/fantaxy/Sound-AI-SFX",
|
258 |
+
"https://huggingface.co/spaces/ginigen/SFX-Sound-magic",
|
259 |
+
"https://huggingface.co/spaces/ginigen/VoiceClone-TTS",
|
260 |
+
"https://huggingface.co/spaces/aiqcamp/ENGLISH-Speaking-Scoring",
|
261 |
+
"https://huggingface.co/spaces/fantaxy/Remove-Video-Background",
|
262 |
+
],
|
263 |
+
"Professional": [
|
264 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-novels",
|
265 |
+
"https://huggingface.co/spaces/aiqtech/SOMA-Oriental",
|
266 |
+
"https://huggingface.co/spaces/VIDraft/SOMA-AGI",
|
267 |
+
"https://huggingface.co/spaces/Heartsync/Novel-NSFW",
|
268 |
+
"https://huggingface.co/spaces/fantaxy/fantasy-novel",
|
269 |
+
"https://huggingface.co/spaces/VIDraft/money-radar",
|
270 |
+
"https://huggingface.co/spaces/immunobiotech/drug-discovery",
|
271 |
+
"https://huggingface.co/spaces/immunobiotech/Gemini-MICHELIN",
|
272 |
+
"https://huggingface.co/spaces/openfree/Cycle-Navigator",
|
273 |
+
"https://huggingface.co/spaces/VIDraft/Fashion-Fit",
|
274 |
+
"https://huggingface.co/spaces/openfree/Stock-Trading-Analysis",
|
275 |
+
"https://huggingface.co/spaces/ginipick/AgentX-Papers",
|
276 |
+
"https://huggingface.co/spaces/Heartsync/Papers-Leaderboard",
|
277 |
+
"https://huggingface.co/spaces/VIDraft/PapersImpact",
|
278 |
+
"https://huggingface.co/spaces/ginigen/multimodal-chat-mbti-korea",
|
279 |
+
],
|
280 |
+
"Image": [
|
281 |
+
"https://huggingface.co/spaces/ginigen/Flux-Kontext-FaceLORA",
|
282 |
+
"https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-REAL",
|
283 |
+
"https://huggingface.co/spaces/ginigen/FLUX-Ghibli-LoRA2",
|
284 |
+
"https://huggingface.co/spaces/aiqcamp/REMOVAL-TEXT-IMAGE",
|
285 |
+
"https://huggingface.co/spaces/VIDraft/BAGEL-Websearch",
|
286 |
+
"https://huggingface.co/spaces/ginigen/Every-Text",
|
287 |
+
"https://huggingface.co/spaces/ginigen/text3d-r1",
|
288 |
+
"https://huggingface.co/spaces/ginipick/FLUXllama",
|
289 |
+
"https://huggingface.co/spaces/ginigen/Workflow-Canvas",
|
290 |
+
"https://huggingface.co/spaces/ginigen/canvas-studio",
|
291 |
+
"https://huggingface.co/spaces/VIDraft/ReSize-Image-Outpainting",
|
292 |
+
"https://huggingface.co/spaces/Heartsync/FLUX-Vision",
|
293 |
+
"https://huggingface.co/spaces/fantos/textcutobject",
|
294 |
+
"https://huggingface.co/spaces/aiqtech/imaginpaint",
|
295 |
+
"https://huggingface.co/spaces/openfree/ColorRevive",
|
296 |
+
"https://huggingface.co/spaces/openfree/ultpixgen",
|
297 |
+
"https://huggingface.co/spaces/VIDraft/Polaroid-Style",
|
298 |
+
"https://huggingface.co/spaces/ginigen/VisualCloze",
|
299 |
+
"https://huggingface.co/spaces/fantaxy/ofai-flx-logo",
|
300 |
+
"https://huggingface.co/spaces/ginigen/interior-design",
|
301 |
+
"https://huggingface.co/spaces/ginigen/MagicFace-V3",
|
302 |
+
"https://huggingface.co/spaces/fantaxy/flx-pulid",
|
303 |
+
"https://huggingface.co/spaces/seawolf2357/Ghibli-Multilingual-Text-rendering",
|
304 |
+
"https://huggingface.co/spaces/VIDraft/Open-Meme-Studio",
|
305 |
+
"https://huggingface.co/spaces/VIDraft/stable-diffusion-3.5-large-turboX",
|
306 |
+
"https://huggingface.co/spaces/aiqtech/flxgif",
|
307 |
+
"https://huggingface.co/spaces/openfree/VectorFlow",
|
308 |
+
"https://huggingface.co/spaces/ginigen/3D-LLAMA",
|
309 |
+
"https://huggingface.co/spaces/ginigen/Multi-LoRAgen",
|
310 |
+
],
|
311 |
+
"LLM / VLM": [
|
312 |
+
"https://huggingface.co/spaces/fantaxy/fantasy-novel",
|
313 |
+
"https://huggingface.co/spaces/ginigen/deepseek-r1-0528-API",
|
314 |
+
"https://huggingface.co/spaces/aiqcamp/Mistral-Devstral-API",
|
315 |
+
"https://huggingface.co/spaces/aiqcamp/deepseek-r1-0528",
|
316 |
+
"https://huggingface.co/spaces/aiqcamp/deepseek-r1-0528-qwen3-8b",
|
317 |
+
"https://huggingface.co/spaces/aiqcamp/deepseek-r1-0528",
|
318 |
+
"https://huggingface.co/spaces/aiqcamp/Mistral-Devstral-API",
|
319 |
+
"https://huggingface.co/spaces/VIDraft/Mistral-RAG-BitSix",
|
320 |
+
"https://huggingface.co/spaces/VIDraft/Gemma-3-R1984-4B",
|
321 |
+
"https://huggingface.co/spaces/VIDraft/Gemma-3-R1984-12B",
|
322 |
+
"https://huggingface.co/spaces/ginigen/Mistral-Perflexity",
|
323 |
+
"https://huggingface.co/spaces/aiqcamp/gemini-2.5-flash-preview",
|
324 |
+
"https://huggingface.co/spaces/openfree/qwen3-30b-a3b-research",
|
325 |
+
"https://huggingface.co/spaces/openfree/qwen3-235b-a22b-research",
|
326 |
+
"https://huggingface.co/spaces/openfree/Llama-4-Maverick-17B-Research",
|
327 |
+
],
|
328 |
+
}
|
329 |
|
330 |
+
# ────────────────────────── 3. URL HELPERS ──────────────────────────
|
331 |
+
def direct_url(hf_url):
|
332 |
+
m = re.match(r"https?://huggingface\.co/spaces/([^/]+)/([^/?#]+)", hf_url)
|
333 |
+
if not m:
|
334 |
+
return hf_url
|
335 |
+
owner, name = m.groups()
|
336 |
+
owner = owner.lower()
|
337 |
+
name = name.replace('.', '-').replace('_', '-').lower()
|
338 |
+
return f"https://{owner}-{name}.hf.space"
|
339 |
+
|
340 |
+
def screenshot_url(url):
|
341 |
+
return f"https://image.thum.io/get/fullpage/{url}"
|
342 |
+
|
343 |
+
def process_url_for_preview(url):
|
344 |
+
"""Returns (preview_url, mode)"""
|
345 |
+
# Handle blocked domains first
|
346 |
+
if any(d for d in BLOCKED_DOMAINS if d in url):
|
347 |
+
return screenshot_url(url), "snapshot"
|
348 |
|
349 |
+
# Special case handling for problematic URLs
|
350 |
+
if "vibe-coding-tetris" in url or "World-of-Tank-GAME" in url or "Minesweeper-Game" in url:
|
351 |
+
return screenshot_url(url), "snapshot"
|
352 |
|
353 |
+
# General HF space handling
|
354 |
+
try:
|
355 |
+
if "huggingface.co/spaces" in url:
|
356 |
+
parts = url.rstrip("/").split("/")
|
357 |
+
if len(parts) >= 5:
|
358 |
+
owner = parts[-2]
|
359 |
+
name = parts[-1]
|
360 |
+
embed_url = f"https://huggingface.co/spaces/{owner}/{name}/embed"
|
361 |
+
return embed_url, "iframe"
|
362 |
+
except Exception:
|
363 |
+
return screenshot_url(url), "snapshot"
|
364 |
|
365 |
+
# Default handling
|
366 |
+
return url, "iframe"
|
367 |
+
|
368 |
+
# ────────────────────────── 4. API ROUTES ──────────────────────────
|
369 |
+
@app.route('/api/category')
|
370 |
+
def api_category():
|
371 |
+
cat = request.args.get('name', '')
|
372 |
+
urls = CATEGORIES.get(cat, [])
|
|
|
|
|
|
|
|
|
373 |
|
374 |
+
# Add pagination for categories
|
375 |
+
page = int(request.args.get('page', 1))
|
376 |
+
per_page = int(request.args.get('per_page', 4))
|
377 |
|
378 |
+
total_pages = max(1, (len(urls) + per_page - 1) // per_page)
|
379 |
+
start = (page - 1) * per_page
|
380 |
+
end = min(start + per_page, len(urls))
|
381 |
|
382 |
+
urls_page = urls[start:end]
|
|
|
|
|
383 |
|
384 |
+
items = [
|
385 |
+
{
|
386 |
+
"title": url.split('/')[-1],
|
387 |
+
"owner": url.split('/')[-2] if '/spaces/' in url else '',
|
388 |
+
"iframe": direct_url(url),
|
389 |
+
"shot": screenshot_url(url),
|
390 |
+
"hf": url
|
391 |
+
} for url in urls_page
|
392 |
+
]
|
393 |
|
394 |
+
return jsonify({
|
395 |
+
"items": items,
|
396 |
+
"page": page,
|
397 |
+
"total_pages": total_pages
|
398 |
+
})
|
399 |
+
|
400 |
+
# ────────────────────────── 5. MAIN ROUTES ──────────────────────────
|
401 |
+
@app.route('/')
|
402 |
+
def home():
|
403 |
+
os.makedirs('templates', exist_ok=True)
|
404 |
|
405 |
+
with open('templates/index.html', 'w', encoding='utf-8') as fp:
|
406 |
+
fp.write(r'''<!DOCTYPE html>
|
407 |
+
<html>
|
408 |
+
<head>
|
409 |
+
<meta charset="utf-8">
|
410 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
411 |
+
<title>Web Gallery</title>
|
412 |
+
<style>
|
413 |
+
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;600&display=swap');
|
414 |
+
body{margin:0;font-family:Nunito,sans-serif;background:#f6f8fb;}
|
415 |
+
.tabs{display:flex;flex-wrap:wrap;gap:8px;padding:16px;}
|
416 |
+
.tab{padding:6px 14px;border:none;border-radius:18px;background:#e2e8f0;font-weight:600;cursor:pointer;}
|
417 |
+
.tab.active{background:#a78bfa;color:#1a202c;}
|
418 |
+
.tab.popular{background:#ff6b6b;color:white;}
|
419 |
+
.tab.popular.active{background:#fa5252;color:white;}
|
420 |
+
.tab.best{background:#4ecdc4;color:white;}
|
421 |
+
.tab.best.active{background:#38d9a9;color:white;}
|
422 |
+
.tab.new{background:#ffe066;color:#1a202c;}
|
423 |
+
.tab.new.active{background:#ffd43b;color:#1a202c;}
|
424 |
+
/* Updated grid to show 2x2 layout */
|
425 |
+
.grid{display:grid;grid-template-columns:repeat(2,1fr);gap:20px;padding:0 16px 60px;max-width:1200px;margin:0 auto;}
|
426 |
+
@media(max-width:800px){.grid{grid-template-columns:1fr;}}
|
427 |
+
/* Increased card height for larger display */
|
428 |
+
.card{background:#fff;border-radius:12px;box-shadow:0 2px 8px rgba(0,0,0,.08);overflow:hidden;height:540px;display:flex;flex-direction:column;position:relative;}
|
429 |
+
.frame{flex:1;position:relative;overflow:hidden;}
|
430 |
+
.frame iframe{position:absolute;width:166.667%;height:166.667%;transform:scale(.6);transform-origin:top left;border:0;}
|
431 |
+
.frame img{width:100%;height:100%;object-fit:cover;}
|
432 |
+
.card-label{position:absolute;top:10px;left:10px;padding:4px 8px;border-radius:4px;font-size:11px;font-weight:bold;z-index:100;text-transform:uppercase;letter-spacing:0.5px;box-shadow:0 2px 4px rgba(0,0,0,0.2);}
|
433 |
+
.label-live{background:linear-gradient(135deg, #00c6ff, #0072ff);color:white;}
|
434 |
+
.label-static{background:linear-gradient(135deg, #ff9a9e, #fad0c4);color:#333;}
|
435 |
+
.foot{height:44px;background:#fafafa;display:flex;align-items:center;justify-content:center;border-top:1px solid #eee;}
|
436 |
+
.foot a{font-size:.82rem;font-weight:700;color:#4a6dd8;text-decoration:none;}
|
437 |
+
.pagination{display:flex;justify-content:center;margin:20px 0;gap:10px;}
|
438 |
+
.pagination button{padding:5px 15px;border:none;border-radius:20px;background:#e2e8f0;cursor:pointer;}
|
439 |
+
.pagination button:disabled{opacity:0.5;cursor:not-allowed;}
|
440 |
+
</style>
|
441 |
+
</head>
|
442 |
+
<body>
|
443 |
+
<header style="text-align: center; padding: 20px; background: linear-gradient(135deg, #f6f8fb, #e2e8f0); border-bottom: 1px solid #ddd;">
|
444 |
+
<h1 style="margin-bottom: 10px;">🌟OPEN & Free: BEST AI Playground</h1>
|
445 |
+
<p>
|
446 |
+
<a href="https://huggingface.co/OpenFreeAI" target="_blank"><img src="https://img.shields.io/static/v1?label=Community&message=OpenFree_AI&color=%23800080&labelColor=%23000080&logo=HUGGINGFACE&logoColor=%23ffa500&style=for-the-badge" alt="badge"></a>
|
447 |
+
<a href="https://discord.gg/openfreeai" target="_blank"><img src="https://img.shields.io/static/v1?label=Discord&message=Openfree%20AI&color=%230000ff&labelColor=%23800080&logo=discord&logoColor=white&style=for-the-badge" alt="badge"></a>
|
448 |
+
<a href="https://huggingface.co/spaces/openfree/Best-AI" target="_blank"><img src="https://img.shields.io/static/v1?label=OpenFree&message=BEST%20AI%20Services&color=%230000ff&labelColor=%23000080&logo=huggingface&logoColor=%23ffa500&style=for-the-badge" alt="badge"></a>
|
449 |
+
</p>
|
450 |
+
</header>
|
451 |
+
<div class="tabs" id="tabs"></div>
|
452 |
+
<div id="content"></div>
|
453 |
+
|
454 |
+
<script>
|
455 |
+
// Basic configuration
|
456 |
+
const cats = {{cats|tojson}};
|
457 |
+
const tabs = document.getElementById('tabs');
|
458 |
+
const content = document.getElementById('content');
|
459 |
+
let active = "";
|
460 |
+
let currentPage = 1;
|
461 |
+
|
462 |
+
// Simple utility functions
|
463 |
+
function makeRequest(url, method, data, callback) {
|
464 |
+
const xhr = new XMLHttpRequest();
|
465 |
+
xhr.open(method, url, true);
|
466 |
+
xhr.onreadystatechange = function() {
|
467 |
+
if (xhr.readyState === 4 && xhr.status === 200) {
|
468 |
+
callback(JSON.parse(xhr.responseText));
|
469 |
+
}
|
470 |
+
};
|
471 |
+
if (method === 'POST') {
|
472 |
+
xhr.send(data);
|
473 |
+
} else {
|
474 |
+
xhr.send();
|
475 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
476 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
477 |
|
478 |
+
function updateTabs() {
|
479 |
+
Array.from(tabs.children).forEach(b => {
|
480 |
+
b.classList.toggle('active', b.dataset.c === active);
|
481 |
+
});
|
482 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
483 |
|
484 |
+
// Tab handlers
|
485 |
+
function loadCategory(cat, page) {
|
486 |
+
if(cat === active && currentPage === page) return;
|
487 |
+
active = cat;
|
488 |
+
currentPage = page || 1;
|
489 |
+
updateTabs();
|
490 |
+
|
491 |
+
content.innerHTML = '<p style="text-align:center;padding:40px">Loading…</p>';
|
492 |
+
|
493 |
+
makeRequest('/api/category?name=' + encodeURIComponent(cat) + '&page=' + currentPage + '&per_page=4', 'GET', null, function(data) {
|
494 |
+
let html = '<div class="grid">';
|
495 |
+
|
496 |
+
if(data.items.length === 0) {
|
497 |
+
html += '<p style="grid-column:1/-1;text-align:center;padding:40px">No items in this category.</p>';
|
498 |
+
} else {
|
499 |
+
data.items.forEach(item => {
|
500 |
+
html += `
|
501 |
+
<div class="card">
|
502 |
+
<div class="card-label label-live">LIVE</div>
|
503 |
+
<div class="frame">
|
504 |
+
<iframe src="${item.iframe}" loading="lazy" sandbox="allow-forms allow-modals allow-popups allow-same-origin allow-scripts allow-downloads"></iframe>
|
505 |
+
</div>
|
506 |
+
<div class="foot">
|
507 |
+
<a href="${item.hf}" target="_blank">${item.title}</a>
|
508 |
+
</div>
|
509 |
+
</div>
|
510 |
+
`;
|
511 |
+
});
|
512 |
+
}
|
513 |
+
|
514 |
+
html += '</div>';
|
515 |
+
|
516 |
+
// Add pagination
|
517 |
+
html += `
|
518 |
+
<div class="pagination">
|
519 |
+
<button ${currentPage <= 1 ? 'disabled' : ''} onclick="loadCategory('${cat}', ${currentPage-1})">« Previous</button>
|
520 |
+
<span>Page ${currentPage} of ${data.total_pages}</span>
|
521 |
+
<button ${currentPage >= data.total_pages ? 'disabled' : ''} onclick="loadCategory('${cat}', ${currentPage+1})">Next »</button>
|
522 |
+
</div>
|
523 |
+
`;
|
524 |
+
|
525 |
+
content.innerHTML = html;
|
526 |
+
});
|
527 |
+
}
|
528 |
|
529 |
+
// Create tabs
|
530 |
+
// Special tabs first (Popular, BEST, NEW)
|
531 |
+
['Popular', 'BEST', 'NEW'].forEach(specialCat => {
|
532 |
+
const b = document.createElement('button');
|
533 |
+
b.className = 'tab ' + specialCat.toLowerCase();
|
534 |
+
b.textContent = specialCat;
|
535 |
+
b.dataset.c = specialCat;
|
536 |
+
b.onclick = function() { loadCategory(specialCat, 1); };
|
537 |
+
tabs.appendChild(b);
|
538 |
+
});
|
539 |
+
|
540 |
+
// Regular category tabs
|
541 |
+
cats.forEach(c => {
|
542 |
+
if (!['Popular', 'BEST', 'NEW'].includes(c)) {
|
543 |
+
const b = document.createElement('button');
|
544 |
+
b.className = 'tab';
|
545 |
+
b.textContent = c;
|
546 |
+
b.dataset.c = c;
|
547 |
+
b.onclick = function() { loadCategory(c, 1); };
|
548 |
+
tabs.appendChild(b);
|
549 |
+
}
|
550 |
+
});
|
551 |
+
|
552 |
+
// Start with Popular tab
|
553 |
+
loadCategory('Popular', 1);
|
554 |
+
</script>
|
555 |
+
</body>
|
556 |
+
</html>''')
|
557 |
+
|
558 |
+
# Return the rendered template
|
559 |
+
return render_template('index.html', cats=list(CATEGORIES.keys()))
|
560 |
|
561 |
+
if __name__ == '__main__':
|
562 |
+
app.run(host='0.0.0.0', port=7860)
|
|
|
|
|
|
|
|
|
|