openfree commited on
Commit
06c4aba
ยท
verified ยท
1 Parent(s): 598d6c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +519 -51
app.py CHANGED
@@ -1,7 +1,18 @@
1
- import gradio as gr
2
- import re
3
 
4
- # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ CATEGORIES โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
 
 
 
 
 
 
 
 
 
 
 
5
  CATEGORIES = {
6
  "Popular": [
7
  "https://huggingface.co/spaces/fantos/Heatmap-Leaderboard-KOREA",
@@ -10,49 +21,346 @@ CATEGORIES = {
10
  "https://huggingface.co/spaces/ginigen/SAJU",
11
  "https://huggingface.co/spaces/ginipick/SAJU-Couple",
12
  "https://huggingface.co/spaces/openfree/News-AI",
 
13
  "https://huggingface.co/spaces/openfree/Face-blurring",
14
  "https://huggingface.co/spaces/ginigen/Fashion-Fit360",
15
  "https://huggingface.co/spaces/VIDraft/DNA-Diffusion",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  "https://huggingface.co/spaces/ginigen/VEO3-Free",
 
17
  "https://huggingface.co/spaces/ginigen/text3d-r1",
18
  "https://huggingface.co/spaces/VIDraft/stable-diffusion-3.5-large-turboX",
 
19
  ],
20
  "BEST": [
 
21
  "https://huggingface.co/spaces/ginipick/AGI-Personal",
22
  "https://huggingface.co/spaces/ginigen/AI",
 
 
23
  "https://huggingface.co/spaces/ginigen/AGI-WebToon-KOREA",
 
 
 
24
  "https://huggingface.co/spaces/ginigen/Flux-Kontext-Style",
 
 
25
  "https://huggingface.co/spaces/ginigen/Seedance-Free",
26
  "https://huggingface.co/spaces/VIDraft/SOMA-AGI",
27
  "https://huggingface.co/spaces/aiqtech/Heatmap-Leaderboard",
 
 
28
  "https://huggingface.co/spaces/VIDraft/DNA-CASINO",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  ],
30
  "NEW": [
31
  "https://huggingface.co/spaces/ginigen/Family",
 
32
  "https://huggingface.co/spaces/openfree/OpenAI-gpt-oss",
 
 
33
  "https://huggingface.co/spaces/ginipick/Private-AI",
34
  "https://huggingface.co/spaces/VIDraft/ACE-Singer",
35
  "https://huggingface.co/spaces/ginipick/AI-BOOK",
 
 
 
 
 
 
 
 
 
 
 
36
  "https://huggingface.co/spaces/Heartsync/VEO3-RealTime",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  ],
38
  "Multimodal": [
 
 
39
  "https://huggingface.co/spaces/ginigen/Seedance-Free",
40
  "https://huggingface.co/spaces/Heartsync/VEO3-RealTime",
41
  "https://huggingface.co/spaces/ginigen/VEO3-Free",
 
 
 
 
 
 
 
 
 
 
42
  "https://huggingface.co/spaces/ginigen/Flux-VIDEO",
 
43
  "https://huggingface.co/spaces/VIDraft/ACE-Singer",
 
 
 
44
  "https://huggingface.co/spaces/ginigen/VoiceClone-TTS",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  ],
46
  "Image": [
47
  "https://huggingface.co/spaces/openfree/Face-blurring",
48
  "https://huggingface.co/spaces/ginigen/Flux-Kontext-FaceLORA",
 
 
 
 
 
49
  "https://huggingface.co/spaces/ginigen/text3d-r1",
50
  "https://huggingface.co/spaces/ginipick/FLUXllama",
 
 
 
 
 
 
 
 
 
 
 
 
51
  "https://huggingface.co/spaces/ginigen/MagicFace-V3",
 
 
 
52
  "https://huggingface.co/spaces/VIDraft/stable-diffusion-3.5-large-turboX",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  ],
54
  }
55
 
 
56
  def direct_url(hf_url):
57
  m = re.match(r"https?://huggingface\.co/spaces/([^/]+)/([^/?#]+)", hf_url)
58
  if not m:
@@ -62,59 +370,219 @@ def direct_url(hf_url):
62
  name = name.replace('.', '-').replace('_', '-').lower()
63
  return f"https://{owner}-{name}.hf.space"
64
 
65
- def create_gallery_html(category):
66
- urls = CATEGORIES.get(category, [])[:8] # Show first 8
 
 
 
 
 
 
67
 
68
- html = '<div style="display:grid;grid-template-columns:repeat(2,1fr);gap:20px;padding:20px;max-width:1400px;margin:0 auto;">'
 
 
69
 
70
- for url in urls:
71
- title = url.split('/')[-1]
72
- iframe_url = direct_url(url)
73
-
74
- html += f'''
75
- <div style="background:#fff;border-radius:12px;box-shadow:0 2px 8px rgba(0,0,0,.08);overflow:hidden;height:500px;display:flex;flex-direction:column;">
76
- <div style="flex:1;position:relative;overflow:hidden;background:#f5f5f5;">
77
- <div style="position:absolute;top:10px;left:10px;padding:4px 8px;border-radius:4px;background:linear-gradient(135deg,#00c6ff,#0072ff);color:white;font-size:11px;font-weight:bold;z-index:10;">LIVE</div>
78
- <iframe src="{iframe_url}" style="width:100%;height:100%;border:0;" loading="lazy" sandbox="allow-forms allow-modals allow-popups allow-same-origin allow-scripts"></iframe>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  </div>
80
- <div style="padding:12px;background:#fafafa;border-top:1px solid #eee;text-align:center;">
81
- <a href="{url}" target="_blank" style="font-size:14px;font-weight:600;color:#4a6dd8;text-decoration:none;">{title}</a>
82
  </div>
83
- </div>
84
- '''
 
 
85
 
86
- html += '</div>'
87
- return html
88
-
89
- # Create Gradio interface
90
- with gr.Blocks(
91
- title="๐ŸŒŸ BEST AI Playground",
92
- css="""
93
- @import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap');
94
- body {font-family: 'Nunito', sans-serif !important;}
95
- .gradio-container {max-width: 100% !important;}
96
- """
97
- ) as demo:
98
 
99
- gr.HTML("""
100
- <div style="text-align:center;padding:30px 20px;background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);color:white;border-radius:10px;margin-bottom:20px;">
101
- <h1 style="margin:0 0 15px 0;font-size:2.5em;font-weight:700;">๐ŸŒŸ BEST AI Playground</h1>
102
- <p style="margin:10px 0;font-size:1.1em;">Curated Collection of Amazing AI Spaces on Hugging Face</p>
103
- <div style="margin-top:20px;">
104
- <a href="https://huggingface.co/OpenFreeAI" target="_blank" style="display:inline-block;margin:5px;">
105
- <img src="https://img.shields.io/badge/Community-OpenFree_AI-purple?style=for-the-badge&logo=huggingface" alt="Community">
106
- </a>
107
- <a href="https://discord.gg/openfreeai" target="_blank" style="display:inline-block;margin:5px;">
108
- <img src="https://img.shields.io/badge/Discord-Join_Us-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Discord">
109
- </a>
110
- </div>
111
- </div>
112
- """)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
 
114
- with gr.Tabs():
115
- for category_name, urls in CATEGORIES.items():
116
- with gr.Tab(f"โœจ {category_name}"):
117
- gr.HTML(create_gallery_html(category_name))
118
 
119
- if __name__ == "__main__":
120
- demo.launch()
 
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/fantos/Heatmap-Leaderboard-KOREA",
 
21
  "https://huggingface.co/spaces/ginigen/SAJU",
22
  "https://huggingface.co/spaces/ginipick/SAJU-Couple",
23
  "https://huggingface.co/spaces/openfree/News-AI",
24
+ "https://huggingface.co/spaces/openfree/Creative-Arena-Leaderboard",
25
  "https://huggingface.co/spaces/openfree/Face-blurring",
26
  "https://huggingface.co/spaces/ginigen/Fashion-Fit360",
27
  "https://huggingface.co/spaces/VIDraft/DNA-Diffusion",
28
+ "https://huggingface.co/spaces/Heartsync/Nano-Banana",
29
+ "https://huggingface.co/spaces/openfree/AGI-Screenplay-Pro",
30
+ "https://huggingface.co/spaces/ginipick/FLUXllama",
31
+ "https://huggingface.co/spaces/VIDraft/gpt-oss-RAG",
32
+ "https://openfree-AI-Calcurator.static.hf.space",
33
+ "https://huggingface.co/spaces/openfree/AGI-WebNovel-Gallery",
34
+ "https://huggingface.co/spaces/Heartsync/Wan-2.2-ADULT",
35
+ "https://huggingface.co/spaces/ginigen/Wan-2.2-Enhanced",
36
+ "https://huggingface.co/spaces/openfree/AGI-Screenplay",
37
+ "https://huggingface.co/spaces/openfree/AGI-WebNovel",
38
+ "https://huggingface.co/spaces/openfree/AGI-NOVEL",
39
+ "https://huggingface.co/spaces/fantaxy/AGI-LEADERBOARD",
40
+ "https://cutechicken-3d-airforce-simulator.static.hf.space",
41
+ "https://huggingface.co/spaces/Heartsync/FREE-NSFW-HUB",
42
+ "https://huggingface.co/spaces/ginipick/Private-AI",
43
+ "https://huggingface.co/spaces/fantaxy/ofai-flx-logo",
44
+ "https://huggingface.co/spaces/aiqtech/FLUX-Ghibli-Studio-LoRA",
45
+ "https://huggingface.co/spaces/seawolf2357/REALVISXL-V5",
46
+ "https://huggingface.co/spaces/fantos/flx8lora",
47
+ "https://huggingface.co/spaces/ginipick/Realtime-FLUX",
48
+ "https://huggingface.co/spaces/fantaxy/flx-pulid",
49
+ "https://huggingface.co/spaces/ginipick/FLUX-Prompt-Generator",
50
+ "https://huggingface.co/spaces/aiqtech/kofaceid",
51
+ "https://huggingface.co/spaces/aiqtech/flxgif",
52
+ "https://huggingface.co/spaces/fantos/flxfashmodel",
53
+ "https://huggingface.co/spaces/fantos/flxcontrol",
54
+ "https://huggingface.co/spaces/fantos/textcutobject",
55
+ "https://huggingface.co/spaces/seawolf2357/flxloraexp",
56
+ "https://huggingface.co/spaces/fantaxy/flxloraexp",
57
+ "https://huggingface.co/spaces/aiqtech/imaginpaint",
58
+ "https://huggingface.co/spaces/ginipick/FLUXllama",
59
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored",
60
+ "https://huggingface.co/spaces/fantaxy/flx-upscale",
61
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-video",
62
+ "https://huggingface.co/spaces/fantos/VoiceClone",
63
+ "https://huggingface.co/spaces/fantaxy/Rolls-Royce",
64
+ "https://huggingface.co/spaces/aiqtech/FLUX-military",
65
+ "https://huggingface.co/spaces/fantaxy/FLUX-Animations",
66
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-video2",
67
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-photo",
68
+ "https://huggingface.co/spaces/ginipick/Time-Stream",
69
+ "https://huggingface.co/spaces/seawolf2357/sd-prompt-gen",
70
+ "https://huggingface.co/spaces/openfree/MagicFace-V3",
71
+ "https://huggingface.co/spaces/Heartsync/adult",
72
+ "https://huggingface.co/spaces/Heartsync/wan2-1-fast-security",
73
+ "https://huggingface.co/spaces/seawolf2357/img2vid",
74
+ "https://huggingface.co/spaces/openfree/image-to-vector",
75
+ "https://huggingface.co/spaces/openfree/DreamO-video",
76
+ "https://huggingface.co/spaces/VIDraft/FramePack_rotate_landscape",
77
+ "https://huggingface.co/spaces/fantaxy/Sound-AI-SFX",
78
+ "https://huggingface.co/spaces/ginigen/VoiceClone-TTS",
79
+
80
+ "https://huggingface.co/spaces/Heartsync/NSFW-image",
81
+ "https://huggingface.co/spaces/Heartsync/NSFW-detection",
82
+ "https://huggingface.co/spaces/Heartsync/VEO3-RealTime",
83
  "https://huggingface.co/spaces/ginigen/VEO3-Free",
84
+ "https://huggingface.co/spaces/ginigen/FLUX-Text-Tree-Image",
85
  "https://huggingface.co/spaces/ginigen/text3d-r1",
86
  "https://huggingface.co/spaces/VIDraft/stable-diffusion-3.5-large-turboX",
87
+
88
  ],
89
  "BEST": [
90
+ "https://huggingface.co/spaces/Heartsync/Novel-NSFW",
91
  "https://huggingface.co/spaces/ginipick/AGI-Personal",
92
  "https://huggingface.co/spaces/ginigen/AI",
93
+ "https://openfree-WAR-Game-Simul.static.hf.space",
94
+ "https://ginigen-Hair-Pick.static.hf.space",
95
  "https://huggingface.co/spaces/ginigen/AGI-WebToon-KOREA",
96
+ "https://huggingface.co/spaces/ginigen/webtoon-studio",
97
+ "https://vidraft-ai.static.hf.space",
98
+ "https://huggingface.co/spaces/MaziyarPanahi/FACTS-Leaderboard",
99
  "https://huggingface.co/spaces/ginigen/Flux-Kontext-Style",
100
+ "https://huggingface.co/spaces/openfree/Cycle-Navigator",
101
+ "https://huggingface.co/spaces/ginigen/Flux-Kontext-FaceLORA",
102
  "https://huggingface.co/spaces/ginigen/Seedance-Free",
103
  "https://huggingface.co/spaces/VIDraft/SOMA-AGI",
104
  "https://huggingface.co/spaces/aiqtech/Heatmap-Leaderboard",
105
+ "https://huggingface.co/spaces/Heartsync/PornHUB",
106
+ "https://huggingface.co/spaces/Heartsync/Hentai-Adult",
107
  "https://huggingface.co/spaces/VIDraft/DNA-CASINO",
108
+ "https://huggingface.co/spaces/aiqtech/SOMA-Oriental",
109
+ "https://huggingface.co/spaces/fantaxy/YTB-TEST",
110
+ "https://huggingface.co/spaces/aiqtech/Contributors-Leaderboard",
111
+ "https://huggingface.co/spaces/ginigen/text3d-r1",
112
+ "https://huggingface.co/spaces/VIDraft/stable-diffusion-3.5-large-turboX",
113
+ "https://huggingface.co/spaces/openfree/Korean-Leaderboard",
114
+ "https://huggingface.co/spaces/fantos/flxcontrol",
115
+ "https://huggingface.co/spaces/aiqtech/FLUX-Ghibli-Studio-LoRA",
116
+ "https://huggingface.co/spaces/openfree/AI-Podcast",
117
+ "https://huggingface.co/spaces/ginigen/Workflow-Canvas",
118
+ "https://huggingface.co/spaces/ginigen/3D-LLAMA",
119
+ "https://huggingface.co/spaces/ginigen/VoiceClone-TTS",
120
+ "https://huggingface.co/spaces/VIDraft/ACE-Singer",
121
+ "https://huggingface.co/spaces/ginipick/AI-BOOK",
122
+ "https://huggingface.co/spaces/immunobiotech/drug-discovery",
123
+ "https://huggingface.co/spaces/VIDraft/Robo-Beam",
124
+ "https://huggingface.co/spaces/fantaxy/fantasy-novel",
125
+ "https://huggingface.co/spaces/immunobiotech/Gemini-MICHELIN",
126
+ "https://huggingface.co/spaces/openfree/Chart-GPT",
127
+ "https://huggingface.co/spaces/ginipick/NH-Korea",
128
+ "https://huggingface.co/spaces/VIDraft/Voice-Clone-Podcast",
129
+ "https://huggingface.co/spaces/ginipick/Private-AI",
130
+ "https://huggingface.co/spaces/ginigen/Flux-VIDEO",
131
+ "https://huggingface.co/spaces/openfree/open-GAMMA",
132
+ "https://huggingface.co/spaces/ginipick/PharmAI-Korea",
133
+ "https://huggingface.co/spaces/ginipick/Pharmacy",
134
+ "https://huggingface.co/spaces/ginipick/PDF-EXAM",
135
+ "https://huggingface.co/spaces/ginipick/IDEA-DESIGN",
136
+ "https://huggingface.co/spaces/openfree/DreamO-video",
137
+ "https://huggingface.co/spaces/ginipick/10m-marketing",
138
+ "https://huggingface.co/spaces/VIDraft/voice-trans",
139
+ "https://huggingface.co/spaces/VIDraft/NH-Prediction",
140
+ "https://huggingface.co/spaces/fantos/flx8lora",
141
+ "https://huggingface.co/spaces/ginigen/MagicFace-V3",
142
+ "https://huggingface.co/spaces/openfree/Live-Podcast",
143
+ "https://huggingface.co/spaces/seawolf2357/ocrlatex",
144
+ "https://huggingface.co/spaces/Heartsync/VEO3-RealTime",
145
+ "https://huggingface.co/spaces/ginigen/VEO3-Free",
146
+ "https://huggingface.co/spaces/openfree/MagicFace-V3",
147
+ "https://huggingface.co/spaces/aiqtech/FLUX-military",
148
+ "https://huggingface.co/spaces/fantaxy/flxloraexp",
149
+ "https://huggingface.co/spaces/Heartsync/WAN2-1-fast-T2V-FusioniX",
150
+ "https://huggingface.co/spaces/ginigen/FLUXllama-Multilingual",
151
+ "https://huggingface.co/spaces/Heartsync/wan2-1-fast-security",
152
+ "https://huggingface.co/spaces/fantaxy/Rolls-Royce",
153
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-REAL",
154
+ "https://huggingface.co/spaces/ginipick/Realtime-FLUX",
155
+ "https://huggingface.co/spaces/aiqtech/imaginpaint",
156
+ "https://huggingface.co/spaces/aiqtech/flxgif",
157
+ "https://huggingface.co/spaces/fantos/flxfashmodel",
158
+ "https://huggingface.co/spaces/aiqtech/kofaceid",
159
+ "https://huggingface.co/spaces/ginipick/FLUX-Prompt-Generator",
160
+ "https://huggingface.co/spaces/seawolf2357/REALVISXL-V5",
161
+ "https://huggingface.co/spaces/fantaxy/FLUX-Animations",
162
+ "https://huggingface.co/spaces/fantaxy/flx-pulid",
163
+ "https://huggingface.co/spaces/fantaxy/ofai-flx-logo",
164
+ "https://huggingface.co/spaces/openfree/image-to-vector",
165
+ "https://huggingface.co/spaces/Heartsync/FREE-NSFW-HUB",
166
+ "https://huggingface.co/spaces/seawolf2357/sd-prompt-gen",
167
+ "https://huggingface.co/spaces/VIDraft/FramePack_rotate_landscape",
168
+ "https://huggingface.co/spaces/ginipick/FLUXllama",
169
+ "https://huggingface.co/spaces/Heartsync/NSFW-image",
170
+ "https://huggingface.co/spaces/seawolf2357/img2vid",
171
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-video2",
172
+ "https://huggingface.co/spaces/Heartsync/NSFW-detection",
173
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-video",
174
+ "https://huggingface.co/spaces/Heartsync/adult",
175
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored",
176
+ "https://huggingface.co/spaces/fantos/VoiceClone",
177
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-photo",
178
+ "https://huggingface.co/spaces/fantaxy/flx-upscale",
179
+ "https://huggingface.co/spaces/seawolf2357/flxloraexp",
180
+ "https://huggingface.co/spaces/ginipick/Time-Stream",
181
+ "https://huggingface.co/spaces/fantos/textcutobject",
182
+
183
+
184
  ],
185
  "NEW": [
186
  "https://huggingface.co/spaces/ginigen/Family",
187
+ "https://huggingface.co/spaces/ginigen/AGI-Screenplay",
188
  "https://huggingface.co/spaces/openfree/OpenAI-gpt-oss",
189
+ "https://huggingface.co/spaces/ginigen/Flux-Kontext-Style",
190
+ "https://cutechicken-3d-airforce-simulator.static.hf.space",
191
  "https://huggingface.co/spaces/ginipick/Private-AI",
192
  "https://huggingface.co/spaces/VIDraft/ACE-Singer",
193
  "https://huggingface.co/spaces/ginipick/AI-BOOK",
194
+ "https://huggingface.co/spaces/openfree/Best-AI",
195
+ "https://huggingface.co/spaces/aiqtech/Heatmap-Leaderboard",
196
+ "https://huggingface.co/spaces/VIDraft/DNA-CASINO",
197
+ "https://huggingface.co/spaces/openfree/AGI-Screenplay",
198
+ "https://huggingface.co/spaces/openfree/AGI-WebNovel",
199
+ "https://huggingface.co/spaces/openfree/AGI-NOVEL",
200
+ "https://huggingface.co/spaces/fantaxy/AGI-LEADERBOARD",
201
+ "https://huggingface.co/spaces/ginigen/Seedance-Free",
202
+ "https://huggingface.co/spaces/aiqtech/SOMA-Oriental",
203
+ "https://huggingface.co/spaces/ginigen/Flux-Kontext-FaceLORA",
204
+ "https://huggingface.co/spaces/VIDraft/SOMA-AGI",
205
  "https://huggingface.co/spaces/Heartsync/VEO3-RealTime",
206
+ "https://huggingface.co/spaces/openfree/Open-GAMMA",
207
+ "https://huggingface.co/spaces/ginigen/VEO3-Free",
208
+ "https://huggingface.co/spaces/Heartsync/WAN2-1-fast-T2V-FusioniX",
209
+ "https://huggingface.co/spaces/VIDraft/voice-trans",
210
+ "https://huggingface.co/spaces/VIDraft/Robo-Beam",
211
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-REAL",
212
+ "https://huggingface.co/spaces/fantaxy/fantasy-novel",
213
+ "https://huggingface.co/spaces/openfree/Chart-GPT",
214
+ "https://huggingface.co/spaces/Heartsync/Novel-NSFW",
215
+ "https://huggingface.co/spaces/ginigen/FLUX-Ghibli-LoRA2",
216
+ "https://huggingface.co/spaces/Heartsync/WAN-VIDEO-AUDIO",
217
+ "https://huggingface.co/spaces/Heartsync/wan2-1-fast-security",
218
+ "https://huggingface.co/spaces/ginigen/Flux-VIDEO",
219
+ "https://huggingface.co/spaces/aiqcamp/REMOVAL-TEXT-IMAGE",
220
+ "https://huggingface.co/spaces/VIDraft/Mistral-RAG-BitSix",
221
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-video2",
222
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-video",
223
+ "https://huggingface.co/spaces/fantaxy/YTB-TEST",
224
+ "https://huggingface.co/spaces/Heartsync/FREE-NSFW-HUB",
225
+ "https://huggingface.co/spaces/Heartsync/adult",
226
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-photo",
227
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored",
228
+ "https://huggingface.co/spaces/openfree/Live-Podcast",
229
+ "https://huggingface.co/spaces/openfree/AI-Podcast",
230
+ "https://huggingface.co/spaces/ginipick/NH-Korea",
231
+ "https://huggingface.co/spaces/VIDraft/NH-Prediction",
232
+ "https://huggingface.co/spaces/VIDraft/Voice-Clone-Podcast",
233
+ "https://huggingface.co/spaces/ginipick/PDF-EXAM",
234
+ "https://huggingface.co/spaces/openfree/Game-Gallery",
235
+ "https://huggingface.co/spaces/openfree/Vibe-Game",
236
+ "https://huggingface.co/spaces/ginipick/IDEA-DESIGN",
237
+ "https://huggingface.co/spaces/openfree/Cycle-Navigator",
238
+ "https://huggingface.co/spaces/openfree/DreamO-video",
239
+ "https://huggingface.co/spaces/Heartsync/NSFW-detection",
240
+
241
+
242
+ ],
243
+ "Productivity": [
244
+ "https://huggingface.co/spaces/ginigen/Markets",
245
+ "https://huggingface.co/spaces/aiqtech/Heatmap-Leaderboard",
246
+ "https://huggingface.co/spaces/VIDraft/DNA-CASINO",
247
+ "https://huggingface.co/spaces/openfree/Open-GAMMA",
248
+ "https://huggingface.co/spaces/VIDraft/Robo-Beam",
249
+ "https://huggingface.co/spaces/VIDraft/voice-trans",
250
+ "https://huggingface.co/spaces/Heartsync/FREE-NSFW-HUB",
251
+ "https://huggingface.co/spaces/openfree/Chart-GPT",
252
+ "https://huggingface.co/spaces/ginipick/AI-BOOK",
253
+ "https://huggingface.co/spaces/VIDraft/Voice-Clone-Podcast",
254
+ "https://huggingface.co/spaces/ginipick/PDF-EXAM",
255
+ "https://huggingface.co/spaces/ginigen/perflexity-clone",
256
+ "https://huggingface.co/spaces/ginipick/IDEA-DESIGN",
257
+ "https://huggingface.co/spaces/ginipick/10m-marketing",
258
+ "https://huggingface.co/spaces/openfree/Live-Podcast",
259
+ "https://huggingface.co/spaces/openfree/AI-Podcast",
260
+ "https://huggingface.co/spaces/ginipick/QR-Canvas-plus",
261
+ "https://huggingface.co/spaces/openfree/Badge",
262
+ "https://huggingface.co/spaces/VIDraft/mouse-webgen",
263
+ "https://huggingface.co/spaces/openfree/Vibe-Game",
264
+ "https://huggingface.co/spaces/VIDraft/NH-Prediction",
265
+ "https://huggingface.co/spaces/ginipick/NH-Korea",
266
+ "https://huggingface.co/spaces/openfree/Naming",
267
+ "https://huggingface.co/spaces/ginipick/Change-Hair",
268
  ],
269
  "Multimodal": [
270
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-photo",
271
+ "https://huggingface.co/spaces/fantaxy/YTB-TEST",
272
  "https://huggingface.co/spaces/ginigen/Seedance-Free",
273
  "https://huggingface.co/spaces/Heartsync/VEO3-RealTime",
274
  "https://huggingface.co/spaces/ginigen/VEO3-Free",
275
+ "https://huggingface.co/spaces/ginigen/VEO3-Directors",
276
+ "https://huggingface.co/spaces/Heartsync/WAN2-1-fast-T2V-FusioniX",
277
+ "https://huggingface.co/spaces/Heartsync/adult",
278
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored",
279
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-video2",
280
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-video",
281
+ "https://huggingface.co/spaces/Heartsync/WAN-VIDEO-AUDIO",
282
+ "https://huggingface.co/spaces/Heartsync/wan2-1-fast-security",
283
+ "https://huggingface.co/spaces/ginigen/Flux-VIDEO",
284
+ "https://huggingface.co/spaces/ginigen/3D-LLAMA-V1",
285
  "https://huggingface.co/spaces/ginigen/Flux-VIDEO",
286
+ "https://huggingface.co/spaces/openfree/Multilingual-TTS",
287
  "https://huggingface.co/spaces/VIDraft/ACE-Singer",
288
+ "https://huggingface.co/spaces/openfree/DreamO-video",
289
+ "https://huggingface.co/spaces/fantaxy/Sound-AI-SFX",
290
+ "https://huggingface.co/spaces/ginigen/SFX-Sound-magic",
291
  "https://huggingface.co/spaces/ginigen/VoiceClone-TTS",
292
+ "https://huggingface.co/spaces/aiqcamp/ENGLISH-Speaking-Scoring",
293
+ "https://huggingface.co/spaces/fantaxy/Remove-Video-Background",
294
+ ],
295
+ "Professional": [
296
+ "https://huggingface.co/spaces/Heartsync/NSFW-novels",
297
+ "https://huggingface.co/spaces/aiqtech/SOMA-Oriental",
298
+ "https://huggingface.co/spaces/VIDraft/SOMA-AGI",
299
+ "https://huggingface.co/spaces/Heartsync/Novel-NSFW",
300
+ "https://huggingface.co/spaces/fantaxy/fantasy-novel",
301
+ "https://huggingface.co/spaces/VIDraft/money-radar",
302
+ "https://huggingface.co/spaces/immunobiotech/drug-discovery",
303
+ "https://huggingface.co/spaces/immunobiotech/Gemini-MICHELIN",
304
+ "https://huggingface.co/spaces/openfree/Cycle-Navigator",
305
+ "https://huggingface.co/spaces/VIDraft/Fashion-Fit",
306
+ "https://huggingface.co/spaces/openfree/Stock-Trading-Analysis",
307
+ "https://huggingface.co/spaces/ginipick/AgentX-Papers",
308
+ "https://huggingface.co/spaces/Heartsync/Papers-Leaderboard",
309
+ "https://huggingface.co/spaces/VIDraft/PapersImpact",
310
+ "https://huggingface.co/spaces/ginigen/multimodal-chat-mbti-korea",
311
  ],
312
  "Image": [
313
  "https://huggingface.co/spaces/openfree/Face-blurring",
314
  "https://huggingface.co/spaces/ginigen/Flux-Kontext-FaceLORA",
315
+ "https://huggingface.co/spaces/Heartsync/NSFW-Uncensored-REAL",
316
+ "https://huggingface.co/spaces/ginigen/FLUX-Ghibli-LoRA2",
317
+ "https://huggingface.co/spaces/aiqcamp/REMOVAL-TEXT-IMAGE",
318
+ "https://huggingface.co/spaces/VIDraft/BAGEL-Websearch",
319
+ "https://huggingface.co/spaces/ginigen/Every-Text",
320
  "https://huggingface.co/spaces/ginigen/text3d-r1",
321
  "https://huggingface.co/spaces/ginipick/FLUXllama",
322
+ "https://huggingface.co/spaces/ginigen/Workflow-Canvas",
323
+ "https://huggingface.co/spaces/ginigen/canvas-studio",
324
+ "https://huggingface.co/spaces/VIDraft/ReSize-Image-Outpainting",
325
+ "https://huggingface.co/spaces/Heartsync/FLUX-Vision",
326
+ "https://huggingface.co/spaces/fantos/textcutobject",
327
+ "https://huggingface.co/spaces/aiqtech/imaginpaint",
328
+ "https://huggingface.co/spaces/openfree/ColorRevive",
329
+ "https://huggingface.co/spaces/openfree/ultpixgen",
330
+ "https://huggingface.co/spaces/VIDraft/Polaroid-Style",
331
+ "https://huggingface.co/spaces/ginigen/VisualCloze",
332
+ "https://huggingface.co/spaces/fantaxy/ofai-flx-logo",
333
+ "https://huggingface.co/spaces/ginigen/interior-design",
334
  "https://huggingface.co/spaces/ginigen/MagicFace-V3",
335
+ "https://huggingface.co/spaces/fantaxy/flx-pulid",
336
+ "https://huggingface.co/spaces/seawolf2357/Ghibli-Multilingual-Text-rendering",
337
+ "https://huggingface.co/spaces/VIDraft/Open-Meme-Studio",
338
  "https://huggingface.co/spaces/VIDraft/stable-diffusion-3.5-large-turboX",
339
+ "https://huggingface.co/spaces/aiqtech/flxgif",
340
+ "https://huggingface.co/spaces/openfree/VectorFlow",
341
+ "https://huggingface.co/spaces/ginigen/3D-LLAMA",
342
+ "https://huggingface.co/spaces/ginigen/Multi-LoRAgen",
343
+ ],
344
+ "LLM / VLM": [
345
+ "https://huggingface.co/spaces/fantaxy/fantasy-novel",
346
+ "https://huggingface.co/spaces/ginigen/deepseek-r1-0528-API",
347
+ "https://huggingface.co/spaces/aiqcamp/Mistral-Devstral-API",
348
+ "https://huggingface.co/spaces/aiqcamp/deepseek-r1-0528",
349
+ "https://huggingface.co/spaces/aiqcamp/deepseek-r1-0528-qwen3-8b",
350
+ "https://huggingface.co/spaces/aiqcamp/deepseek-r1-0528",
351
+ "https://huggingface.co/spaces/aiqcamp/Mistral-Devstral-API",
352
+ "https://huggingface.co/spaces/VIDraft/Mistral-RAG-BitSix",
353
+ "https://huggingface.co/spaces/VIDraft/Gemma-3-R1984-4B",
354
+ "https://huggingface.co/spaces/VIDraft/Gemma-3-R1984-12B",
355
+ "https://huggingface.co/spaces/ginigen/Mistral-Perflexity",
356
+ "https://huggingface.co/spaces/aiqcamp/gemini-2.5-flash-preview",
357
+ "https://huggingface.co/spaces/openfree/qwen3-30b-a3b-research",
358
+ "https://huggingface.co/spaces/openfree/qwen3-235b-a22b-research",
359
+ "https://huggingface.co/spaces/openfree/Llama-4-Maverick-17B-Research",
360
  ],
361
  }
362
 
363
+ # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ 3. URL HELPERS โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
364
  def direct_url(hf_url):
365
  m = re.match(r"https?://huggingface\.co/spaces/([^/]+)/([^/?#]+)", hf_url)
366
  if not m:
 
370
  name = name.replace('.', '-').replace('_', '-').lower()
371
  return f"https://{owner}-{name}.hf.space"
372
 
373
+ def screenshot_url(url):
374
+ return f"https://image.thum.io/get/fullpage/{url}"
375
+
376
+ def process_url_for_preview(url):
377
+ """Returns (preview_url, mode)"""
378
+ # Handle blocked domains first
379
+ if any(d for d in BLOCKED_DOMAINS if d in url):
380
+ return screenshot_url(url), "snapshot"
381
 
382
+ # Special case handling for problematic URLs
383
+ if "vibe-coding-tetris" in url or "World-of-Tank-GAME" in url or "Minesweeper-Game" in url:
384
+ return screenshot_url(url), "snapshot"
385
 
386
+ # General HF space handling
387
+ try:
388
+ if "huggingface.co/spaces" in url:
389
+ parts = url.rstrip("/").split("/")
390
+ if len(parts) >= 5:
391
+ owner = parts[-2]
392
+ name = parts[-1]
393
+ embed_url = f"https://huggingface.co/spaces/{owner}/{name}/embed"
394
+ return embed_url, "iframe"
395
+ except Exception:
396
+ return screenshot_url(url), "snapshot"
397
+
398
+ # Default handling
399
+ return url, "iframe"
400
+
401
+ # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ 4. API ROUTES โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
402
+ @app.route('/api/category')
403
+ def api_category():
404
+ cat = request.args.get('name', '')
405
+ urls = CATEGORIES.get(cat, [])
406
+
407
+ # Add pagination for categories
408
+ page = int(request.args.get('page', 1))
409
+ per_page = int(request.args.get('per_page', 4))
410
+
411
+ total_pages = max(1, (len(urls) + per_page - 1) // per_page)
412
+ start = (page - 1) * per_page
413
+ end = min(start + per_page, len(urls))
414
+
415
+ urls_page = urls[start:end]
416
+
417
+ items = [
418
+ {
419
+ "title": url.split('/')[-1],
420
+ "owner": url.split('/')[-2] if '/spaces/' in url else '',
421
+ "iframe": direct_url(url),
422
+ "shot": screenshot_url(url),
423
+ "hf": url
424
+ } for url in urls_page
425
+ ]
426
+
427
+ return jsonify({
428
+ "items": items,
429
+ "page": page,
430
+ "total_pages": total_pages
431
+ })
432
+
433
+ # โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ 5. MAIN ROUTES โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
434
+ @app.route('/')
435
+ def home():
436
+ os.makedirs('templates', exist_ok=True)
437
+
438
+ with open('templates/index.html', 'w', encoding='utf-8') as fp:
439
+ fp.write(r'''<!DOCTYPE html>
440
+ <html>
441
+ <head>
442
+ <meta charset="utf-8">
443
+ <meta name="viewport" content="width=device-width, initial-scale=1">
444
+ <title>Web Gallery</title>
445
+ <style>
446
+ @import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;600&display=swap');
447
+ body{margin:0;font-family:Nunito,sans-serif;background:#f6f8fb;}
448
+ .tabs{display:flex;flex-wrap:wrap;gap:8px;padding:16px;}
449
+ .tab{padding:6px 14px;border:none;border-radius:18px;background:#e2e8f0;font-weight:600;cursor:pointer;}
450
+ .tab.active{background:#a78bfa;color:#1a202c;}
451
+ .tab.popular{background:#ff6b6b;color:white;}
452
+ .tab.popular.active{background:#fa5252;color:white;}
453
+ .tab.best{background:#4ecdc4;color:white;}
454
+ .tab.best.active{background:#38d9a9;color:white;}
455
+ .tab.new{background:#ffe066;color:#1a202c;}
456
+ .tab.new.active{background:#ffd43b;color:#1a202c;}
457
+ /* Updated grid to show 2x2 layout */
458
+ .grid{display:grid;grid-template-columns:repeat(2,1fr);gap:20px;padding:0 16px 60px;max-width:1200px;margin:0 auto;}
459
+ @media(max-width:800px){.grid{grid-template-columns:1fr;}}
460
+ /* Increased card height for larger display */
461
+ .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;}
462
+ .frame{flex:1;position:relative;overflow:hidden;}
463
+ .frame iframe{position:absolute;width:166.667%;height:166.667%;transform:scale(.6);transform-origin:top left;border:0;}
464
+ .frame img{width:100%;height:100%;object-fit:cover;}
465
+ .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);}
466
+ .label-live{background:linear-gradient(135deg, #00c6ff, #0072ff);color:white;}
467
+ .label-static{background:linear-gradient(135deg, #ff9a9e, #fad0c4);color:#333;}
468
+ .foot{height:44px;background:#fafafa;display:flex;align-items:center;justify-content:center;border-top:1px solid #eee;}
469
+ .foot a{font-size:.82rem;font-weight:700;color:#4a6dd8;text-decoration:none;}
470
+ .pagination{display:flex;justify-content:center;margin:20px 0;gap:10px;}
471
+ .pagination button{padding:5px 15px;border:none;border-radius:20px;background:#e2e8f0;cursor:pointer;}
472
+ .pagination button:disabled{opacity:0.5;cursor:not-allowed;}
473
+ </style>
474
+ </head>
475
+ <body>
476
+ <header style="text-align: center; padding: 20px; background: linear-gradient(135deg, #f6f8fb, #e2e8f0); border-bottom: 1px solid #ddd;">
477
+ <h1 style="margin-bottom: 10px;">๐ŸŒŸOPEN & Free: BEST AI Playground</h1>
478
+ <p>
479
+ <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>
480
+ <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>
481
+ <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>
482
+ </p>
483
+ </header>
484
+ <div class="tabs" id="tabs"></div>
485
+ <div id="content"></div>
486
+ <script>
487
+ // Basic configuration
488
+ const cats = {{cats|tojson}};
489
+ const tabs = document.getElementById('tabs');
490
+ const content = document.getElementById('content');
491
+ let active = "";
492
+ let currentPage = 1;
493
+ // Simple utility functions
494
+ function makeRequest(url, method, data, callback) {
495
+ const xhr = new XMLHttpRequest();
496
+ xhr.open(method, url, true);
497
+ xhr.onreadystatechange = function() {
498
+ if (xhr.readyState === 4 && xhr.status === 200) {
499
+ callback(JSON.parse(xhr.responseText));
500
+ }
501
+ };
502
+ if (method === 'POST') {
503
+ xhr.send(data);
504
+ } else {
505
+ xhr.send();
506
+ }
507
+ }
508
+ function updateTabs() {
509
+ Array.from(tabs.children).forEach(b => {
510
+ b.classList.toggle('active', b.dataset.c === active);
511
+ });
512
+ }
513
+ // Tab handlers
514
+ function loadCategory(cat, page) {
515
+ if(cat === active && currentPage === page) return;
516
+ active = cat;
517
+ currentPage = page || 1;
518
+ updateTabs();
519
+
520
+ content.innerHTML = '<p style="text-align:center;padding:40px">Loadingโ€ฆ</p>';
521
+
522
+ makeRequest('/api/category?name=' + encodeURIComponent(cat) + '&page=' + currentPage + '&per_page=4', 'GET', null, function(data) {
523
+ let html = '<div class="grid">';
524
+
525
+ if(data.items.length === 0) {
526
+ html += '<p style="grid-column:1/-1;text-align:center;padding:40px">No items in this category.</p>';
527
+ } else {
528
+ data.items.forEach(item => {
529
+ html += `
530
+ <div class="card">
531
+ <div class="card-label label-live">LIVE</div>
532
+ <div class="frame">
533
+ <iframe src="${item.iframe}" loading="lazy" sandbox="allow-forms allow-modals allow-popups allow-same-origin allow-scripts allow-downloads"></iframe>
534
  </div>
535
+ <div class="foot">
536
+ <a href="${item.hf}" target="_blank">${item.title}</a>
537
  </div>
538
+ </div>
539
+ `;
540
+ });
541
+ }
542
 
543
+ html += '</div>';
 
 
 
 
 
 
 
 
 
 
 
544
 
545
+ // Add pagination
546
+ html += `
547
+ <div class="pagination">
548
+ <button ${currentPage <= 1 ? 'disabled' : ''} onclick="loadCategory('${cat}', ${currentPage-1})">ยซ Previous</button>
549
+ <span>Page ${currentPage} of ${data.total_pages}</span>
550
+ <button ${currentPage >= data.total_pages ? 'disabled' : ''} onclick="loadCategory('${cat}', ${currentPage+1})">Next ยป</button>
551
+ </div>
552
+ `;
553
+
554
+ content.innerHTML = html;
555
+ });
556
+ }
557
+ // Create tabs
558
+ // Special tabs first (Popular, BEST, NEW)
559
+ ['Popular', 'BEST', 'NEW'].forEach(specialCat => {
560
+ const b = document.createElement('button');
561
+ b.className = 'tab ' + specialCat.toLowerCase();
562
+ b.textContent = specialCat;
563
+ b.dataset.c = specialCat;
564
+ b.onclick = function() { loadCategory(specialCat, 1); };
565
+ tabs.appendChild(b);
566
+ });
567
+ // Regular category tabs
568
+ cats.forEach(c => {
569
+ if (!['Popular', 'BEST', 'NEW'].includes(c)) {
570
+ const b = document.createElement('button');
571
+ b.className = 'tab';
572
+ b.textContent = c;
573
+ b.dataset.c = c;
574
+ b.onclick = function() { loadCategory(c, 1); };
575
+ tabs.appendChild(b);
576
+ }
577
+ });
578
+ // Start with Popular tab
579
+ loadCategory('Popular', 1);
580
+ </script>
581
+ </body>
582
+ </html>''')
583
 
584
+ # Return the rendered template
585
+ return render_template('index.html', cats=list(CATEGORIES.keys()))
 
 
586
 
587
+ if __name__ == '__main__':
588
+ app.run(host='0.0.0.0', port=7860)