Spaces:
Running
Running
Update index.html
Browse files- index.html +449 -286
index.html
CHANGED
|
@@ -1,303 +1,466 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html class="dark" lang="en">
|
| 3 |
<head>
|
| 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 |
-
|
| 97 |
-
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
}
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
}
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
}
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
}
|
| 116 |
-
|
| 117 |
-
.animate-fade-in-up {
|
| 118 |
-
animation: fadeInUp 0.6s ease-out forwards;
|
| 119 |
-
}
|
| 120 |
-
|
| 121 |
-
/* Glow effect for buttons */
|
| 122 |
-
.glow-button {
|
| 123 |
-
position: relative;
|
| 124 |
-
overflow: hidden;
|
| 125 |
-
}
|
| 126 |
-
|
| 127 |
-
.glow-button::before {
|
| 128 |
-
content: '';
|
| 129 |
-
position: absolute;
|
| 130 |
-
top: 0;
|
| 131 |
-
left: -100%;
|
| 132 |
-
width: 100%;
|
| 133 |
-
height: 100%;
|
| 134 |
-
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
|
| 135 |
-
transition: 0.5s;
|
| 136 |
-
}
|
| 137 |
-
|
| 138 |
-
.glow-button:hover::before {
|
| 139 |
-
left: 100%;
|
| 140 |
-
}
|
| 141 |
-
</style>
|
| 142 |
-
</head>
|
| 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 |
-
<main class="flex-grow">
|
| 173 |
-
<!-- Page Content Sections -->
|
| 174 |
-
|
| 175 |
-
<!-- HOME PAGE -->
|
| 176 |
-
<section id="home" class="page-content active">
|
| 177 |
-
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
|
| 178 |
-
<div class="py-16 sm:py-24">
|
| 179 |
-
<div class="relative min-h-[500px] rounded-xl bg-cover bg-center p-8 text-center text-white" style='background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.6)), url("https://lh3.googleusercontent.com/aida-public/AB6AXuCbtu27C_YAnpE3c6WE7xXhfkGRLzYL2k7jNepph6mi8Axf8XYGeVSSHz389ge_a12I7q5Z28_fnzQ_zKgbFOr6kTkUgcwkkewyLVvR5y5eTofYDggkxj8k1g5VEIWetKE4OeA5_6yJHLwh0ieg-bRUG6xjFZxyaRpkdwUuF0a5K4ZCHqJqK6e6UBae5SwYqcnymYoAaVJdSuEP1lcucgsnr8ORqdyBtUiV2U4YaE0UkMkPdr38q0jz1MvrLMCdHEZh1eUSk5BUkIA");'>
|
| 180 |
-
<div class="absolute inset-0 flex flex-col items-center justify-center gap-6">
|
| 181 |
-
<div class="max-w-3xl">
|
| 182 |
-
<h1 class="text-4xl font-bold tracking-tighter sm:text-5xl lg:text-6xl animate-fade-in-up">Get Stunning AI Images That Match Your Brief — Fast</h1>
|
| 183 |
-
<p class="mt-4 text-lg text-gray-200 animate-fade-in-up delay-100">AI-powered visuals, custom prompts & creative automation — delivered in 24–72 hours with unlimited revisions until you're thrilled.</p>
|
| 184 |
-
</div>
|
| 185 |
-
<div class="mt-4 flex flex-wrap justify-center gap-4 animate-fade-in-up delay-200">
|
| 186 |
-
<a href="#" class="glow-button rounded-lg bg-gradient-to-r from-primary-600 to-secondary-600 px-6 py-3 text-base font-bold text-white transition-opacity hover:opacity-90">🔥 Hire on Fiverr →</a> <!-- FIVERR_PROFILE_URL -->
|
| 187 |
-
<a href="#portfolio" data-page="portfolio" class="rounded-lg bg-white/10 px-6 py-3 text-base font-bold text-white backdrop-blur-sm transition-colors hover:bg-white/20 nav-link">View Portfolio →</a>
|
| 188 |
-
</div>
|
| 189 |
-
</div>
|
| 190 |
-
</div>
|
| 191 |
-
</div>
|
| 192 |
-
<div class="py-16 text-center sm:py-24">
|
| 193 |
-
<h2 class="text-3xl font-bold tracking-tight text-gray-900 dark:text-white sm:text-4xl">What You Get & Who It's For</h2>
|
| 194 |
-
<p class="mx-auto mt-4 max-w-3xl text-lg text-gray-600 dark:text-gray-400">
|
| 195 |
-
Professional AI-generated images, custom prompt engineering, and automation tools built specifically for creators, marketers, and entrepreneurs who need stunning visuals without the designer price tag. It's for content creators, brand builders, marketing teams, and anyone who needs eye-catching imagery that converts.
|
| 196 |
-
</p>
|
| 197 |
-
</div>
|
| 198 |
-
<div class="py-8">
|
| 199 |
-
<div class="mx-auto max-w-7xl">
|
| 200 |
-
<div class="grid grid-cols-2 md:grid-cols-5 gap-4 text-center">
|
| 201 |
-
<div class="rounded-lg bg-primary-500/10 p-4 animate-fade-in-up">
|
| 202 |
-
<p class="font-bold text-primary-600 dark:text-white">✓ 5-Star Rated</p>
|
| 203 |
-
</div>
|
| 204 |
-
<div class="rounded-lg bg-primary-500/10 p-4 animate-fade-in-up delay-100">
|
| 205 |
-
<p class="font-bold text-primary-600 dark:text-white">✓ 100+ Projects</p>
|
| 206 |
-
</div>
|
| 207 |
-
<div class="rounded-lg bg-primary-500/10 p-4 animate-fade-in-up delay-200">
|
| 208 |
-
<p class="font-bold text-primary-600 dark:text-white">✓ 24-48 Hour Delivery</p>
|
| 209 |
-
</div>
|
| 210 |
-
<div class="rounded-lg bg-primary-500/10 p-4 animate-fade-in-up delay-300">
|
| 211 |
-
<p class="font-bold text-primary-600 dark:text-white">✓ Unlimited Revisions</p>
|
| 212 |
-
</div>
|
| 213 |
-
<div class="rounded-lg bg-primary-500/10 p-4 col-span-2 md:col-span-1 animate-fade-in-up delay-400">
|
| 214 |
-
<p class="font-bold text-primary-600 dark:text-white">✓ Commercial License</p>
|
| 215 |
-
</div>
|
| 216 |
-
</div>
|
| 217 |
-
</div>
|
| 218 |
-
</div>
|
| 219 |
-
|
| 220 |
-
<div class="py-16 sm:py-24">
|
| 221 |
-
<h2 class="text-center text-3xl font-bold tracking-tight text-gray-900 dark:text-white sm:text-4xl">Visual Showcase</h2>
|
| 222 |
-
<div class="mt-12 grid grid-cols-1 gap-8 md:grid-cols-3 lg:gap-12">
|
| 223 |
-
<div class="flex flex-col gap-4 animate-fade-in-up">
|
| 224 |
-
<div class="aspect-video w-full rounded-lg bg-cover bg-center" style='background-image: url("https://lh3.googleusercontent.com/aida-public/AB6AXuAdmGQeVEZqQ00q1jXG7uFFQiHsCazr49b_ty1jsEs1yMTF-fE2ecZPyD_zjVVKVe-wKYUklxpyiQACU_eEk2xxyIoIqCAb5oM0Z4Be5kWLYQnSnQtzxtAeo9lvvmp9yNDWRq7BOtFl9qucTSXPfvepXTVFzjr1EeF4jPLjdgp7kg1Yivp0oEDk8rKCbd-Htv0KgoQypdMEhVFLwIYaj4AUH5M_NIGNd-nBXJZkKzfHdEWrEQ2ZZksBJpL3KY4jLYsv7kYLPnKzPPs");'></div>
|
| 225 |
-
<div>
|
| 226 |
-
<h3 class="text-lg font-bold text-gray-900 dark:text-white text-center">AI Illustration Sample - Fantasy Landscape</h3>
|
| 227 |
-
</div>
|
| 228 |
-
</div>
|
| 229 |
-
<div class="flex flex-col gap-4 animate-fade-in-up delay-100">
|
| 230 |
-
<div class="aspect-video w-full rounded-lg bg-cover bg-center" style='background-image: url("https://lh3.googleusercontent.com/aida-public/AB6AXuCXeH0ZBFxCjxfwcznootqxR1cDIHdBbS2Jsq6cO63JmEuy-F6OyJBtQHrvc77ZYiCcjPQYBQeEyiW7vB3dL0BgyVaM8lSvj5TCC3yPXvUwbuaF49T8HBSKA61s_JFOxTfnq7Cig7a7vJmZ7FHLgYN-7uQd0E90cM05GWrRWp0uF_32RKyDuqb8Nfm6-q5cVRVF5ooqMKwZNBen0_bod9YUZBQnQ-u9YV9HHvHgQyyKPMPL1qD2a5OqwXjrZrHKwVNwG4WyxmVBKSY");'></div>
|
| 231 |
-
<div>
|
| 232 |
-
<h3 class="text-lg font-bold text-gray-900 dark:text-white text-center">Product Photography Mockup - Tech Device</h3>
|
| 233 |
-
</div>
|
| 234 |
-
</div>
|
| 235 |
-
<div class="flex flex-col gap-4 animate-fade-in-up delay-200">
|
| 236 |
-
<div class="aspect-video w-full rounded-lg bg-cover bg-center" style='background-image: url("https://lh3.googleusercontent.com/aida-public/AB6AXuAUSE9rGmoN7l48MyINrP0_sBfCC5EIGyjWZJ5BWCiZZA2fmSQl-YyhwEqR8tclSG1xAL5o5M5Tvqp9N4C_LxSpFZcPMVtf3USONL7hhp0y86s8OGWqX1YaK5xhSZxDCiNsr6oJ6mEBXrj10eQDUjkrIm1kycE-e-U7xyKx_jxptwwG7jG_1H-qlL20VXTLdu1l96AoPyBA-6zTXZNFamgPV13NQLnXX8mMAWthkSGWlkAybOAvVYJnNFxS-uloPjAW6MdsUdA9GWs");'></div>
|
| 237 |
-
<div>
|
| 238 |
-
<h3 class="text-lg font-bold text-gray-900 dark:text-white text-center">Brand Asset Pack - Logo Variations</h3>
|
| 239 |
-
</div>
|
| 240 |
-
</div>
|
| 241 |
-
</div>
|
| 242 |
-
</div>
|
| 243 |
-
<div class="my-16 flex flex-col items-center justify-center rounded-lg bg-gradient-to-r from-primary-500/10 to-secondary-500/10 py-16 text-center sm:my-24">
|
| 244 |
-
<h2 class="text-3xl font-bold tracking-tight text-gray-900 dark:text-white sm:text-4xl">
|
| 245 |
-
Fast & Reliable. Perfectly Tailored. Full Commercial Rights.
|
| 246 |
-
</h2>
|
| 247 |
-
<p class="mx-auto mt-4 max-w-2xl text-lg text-gray-600 dark:text-gray-400">Based in UAE timezone with responsive support, quick communication, and clear revisions.</p>
|
| 248 |
-
<div class="mt-8">
|
| 249 |
-
<a href="#services" data-page="services" class="nav-link glow-button rounded-lg bg-gradient-to-r from-primary-600 to-secondary-600 px-8 py-3 text-base font-bold text-white transition-opacity hover:opacity-90">
|
| 250 |
-
View Services & Packages
|
| 251 |
-
</a>
|
| 252 |
-
</div>
|
| 253 |
-
</div>
|
| 254 |
-
</div>
|
| 255 |
-
</section>
|
| 256 |
-
|
| 257 |
-
<!-- SERVICES PAGE -->
|
| 258 |
-
<section id="services" class="page-content">
|
| 259 |
-
<div class="py-16 sm:py-24 bg-background-light/50 dark:bg-background-dark/50">
|
| 260 |
-
<div class="container mx-auto px-4 sm:px-6 lg:px-8">
|
| 261 |
-
<div class="text-center">
|
| 262 |
-
<h1 class="text-4xl font-bold tracking-tighter text-gray-900 dark:text-white sm:text-5xl lg:text-6xl"> Services & Packages </h1>
|
| 263 |
-
<p class="mx-auto mt-6 max-w-2xl text-lg text-gray-600 dark:text-gray-400"> Choose the perfect package for your project. All gigs include unlimited revisions and commercial-use licensing. </p>
|
| 264 |
-
</div>
|
| 265 |
-
<div class="mt-20 grid gap-8 lg:grid-cols-2 lg:gap-12">
|
| 266 |
-
<!-- Gig Card 1 -->
|
| 267 |
-
<div class="flex flex-col gap-4 overflow-hidden rounded-lg bg-background-light dark:bg-background-dark border border-gray-200 dark:border-gray-800 shadow-sm transition-all hover:shadow-lg hover:-translate-y-1 p-6">
|
| 268 |
-
<h3 class="text-xl font-bold text-gray-900 dark:text-white">Custom AI Image Generation</h3>
|
| 269 |
-
<p class="text-gray-600 dark:text-gray-400">From concept to final render — I'll create stunning, unique AI images tailored to your exact specifications. Perfect for marketing materials, social media content, product visuals, and creative projects.</p>
|
| 270 |
-
<a href="#" class="mt-auto flex items-center gap-2 self-start rounded bg-primary-500/10 px-4 py-2 text-sm font-semibold text-primary-600 transition-colors hover:bg-primary-500/20">
|
| 271 |
-
Hire on Fiverr → <!-- FIVERR_GIG_URL_1 -->
|
| 272 |
-
</a>
|
| 273 |
-
</div>
|
| 274 |
-
<!-- Gig Card 2 -->
|
| 275 |
-
<div class="flex flex-col gap-4 overflow-hidden rounded-lg bg-background-light dark:bg-background-dark border border-gray-200 dark:border-gray-800 shadow-sm transition-all hover:shadow-lg hover:-translate-y-1 p-6">
|
| 276 |
-
<h3 class="text-xl font-bold text-gray-900 dark:text-white">Professional Prompt Engineering</h3>
|
| 277 |
-
<p class="text-gray-600 dark:text-gray-400">Get expertly crafted prompts that generate exactly what you envision. Perfect for teams running their own AI tools or creators who want repeatable, high-quality results.</p>
|
| 278 |
-
<a href="#" class="mt-auto flex items-center gap-2 self-start rounded bg-primary-500/10 px-4 py-2 text-sm font-semibold text-primary-600 transition-colors hover:bg-primary-500/20">
|
| 279 |
-
Hire on Fiverr → <!-- FIVERR_GIG_URL_2 -->
|
| 280 |
-
</a>
|
| 281 |
-
</div>
|
| 282 |
-
<!-- Gig Card 3 -->
|
| 283 |
-
<div class="flex flex-col gap-4 overflow-hidden rounded-lg bg-background-light dark:bg-background-dark border border-gray-200 dark:border-gray-800 shadow-sm transition-all hover:shadow-lg hover:-translate-y-1 p-6">
|
| 284 |
-
<h3 class="text-xl font-bold text-gray-900 dark:text-white">Creative Automation Workflow</h3>
|
| 285 |
-
<p class="text-gray-600 dark:text-gray-400">Streamline your content creation with custom AI workflows. I'll build automated systems for batch image generation, style consistency, and seamless integration with your existing tools.</p>
|
| 286 |
-
<a href="#" class="mt-auto flex items-center gap-2 self-start rounded bg-primary-500/10 px-4 py-2 text-sm font-semibold text-primary-600 transition-colors hover:bg-primary-500/20">
|
| 287 |
-
Hire on Fiverr → <!-- FIVERR_GIG_URL_3 -->
|
| 288 |
-
</a>
|
| 289 |
-
</div>
|
| 290 |
-
<!-- Gig Card 4 -->
|
| 291 |
-
<div class="flex flex-col gap-4 overflow-hidden rounded-lg bg-background-light dark:bg-background-dark border border-gray-200 dark:border-gray-800 shadow-sm transition-all hover:shadow-lg hover:-translate-y-1 p-6">
|
| 292 |
-
<h3 class="text-xl font-bold text-gray-900 dark:text-white">Brand Visual Identity Pack</h3>
|
| 293 |
-
<p class="text-gray-600 dark:text-gray-400">Complete visual branding package including logo variations, social media templates, and brand assets generated with consistent AI styling for cohesive brand identity.</p>
|
| 294 |
-
<a href="#" class="mt-auto flex items-center gap-2 self-start rounded bg-primary-500/10 px-4 py-2 text-sm font-semibold text-primary-600 transition-colors hover:bg-primary-500/20">
|
| 295 |
-
Hire on Fiverr → <!-- FIVERR_GIG_URL_4 -->
|
| 296 |
-
</a>
|
| 297 |
-
</div>
|
| 298 |
-
</div>
|
| 299 |
-
</div>
|
| 300 |
-
</div>
|
| 301 |
-
</section>
|
| 302 |
</body>
|
| 303 |
-
</html>
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html class="dark" lang="en">
|
| 3 |
<head>
|
| 4 |
+
<meta charset="utf-8" />
|
| 5 |
+
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
| 6 |
+
<title>NeuralNomadAI - HuggingFace Demo (index.html)</title>
|
| 7 |
+
|
| 8 |
+
<!-- Google Fonts -->
|
| 9 |
+
<link href="https://fonts.googleapis.com" rel="preconnect" />
|
| 10 |
+
<link crossorigin href="https://fonts.gstatic.com" rel="preconnect" />
|
| 11 |
+
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&display=swap" rel="stylesheet" />
|
| 12 |
+
|
| 13 |
+
<!-- Tailwind CDN (keeps the original layout & utilities) -->
|
| 14 |
+
<script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
|
| 15 |
+
|
| 16 |
+
<!-- Local CSS for small customizations -->
|
| 17 |
+
<link rel="stylesheet" href="style.css" />
|
| 18 |
+
</head>
|
| 19 |
+
|
| 20 |
+
<body class="bg-gray-50 dark:bg-gray-900 font-display text-gray-900 dark:text-gray-100">
|
| 21 |
+
<div class="flex min-h-screen w-full flex-col">
|
| 22 |
+
<!-- Header -->
|
| 23 |
+
<header class="sticky top-0 z-50 border-b border-gray-200/50 dark:border-gray-700/50 bg-white/80 dark:bg-gray-900/80 backdrop-blur-sm">
|
| 24 |
+
<div class="mx-auto flex max-w-7xl items-center justify-between px-4 py-3">
|
| 25 |
+
<a href="#home" data-page="home" class="flex items-center gap-4 cursor-pointer">
|
| 26 |
+
<svg class="h-8 w-8 text-sky-600" fill="none" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg"><path d="M39.5563 34.1455V13.8546C39.5563 15.708 36.8773 17.3437 32.7927 18.3189C30.2914 18.916 27.263 19.2655 24 19.2655C20.737 19.2655 17.7086 18.916 15.2073 18.3189C11.1227 17.3437 8.44365 15.708 8.44365 13.8546V34.1455C8.44365 35.9988 11.1227 37.6346 15.2073 38.6098C17.7086 39.2069 20.737 39.5564 24 39.5564C27.263 39.5564 30.2914 39.2069 32.7927 38.6098C36.8773 37.6346 39.5563 35.9988 39.5563 34.1455Z" fill="currentColor"></path></svg>
|
| 27 |
+
<h1 class="text-lg font-bold">NeuralNomadAI</h1>
|
| 28 |
+
</a>
|
| 29 |
+
|
| 30 |
+
<nav class="hidden md:flex items-center gap-6">
|
| 31 |
+
<a href="#home" data-page="home" class="nav-link text-sm font-medium">Home</a>
|
| 32 |
+
<a href="#services" data-page="services" class="nav-link text-sm font-medium">Services</a>
|
| 33 |
+
<a href="#portfolio" data-page="portfolio" class="nav-link text-sm font-medium">Portfolio</a>
|
| 34 |
+
<a href="#contact" data-page="contact" class="nav-link text-sm font-medium">Contact</a>
|
| 35 |
+
</nav>
|
| 36 |
+
|
| 37 |
+
<div class="flex items-center gap-4">
|
| 38 |
+
<a href="#contact" data-page="contact" class="rounded-lg bg-sky-600 px-4 py-2 text-sm font-semibold text-white">Get Started</a>
|
| 39 |
+
</div>
|
| 40 |
+
</div>
|
| 41 |
+
</header>
|
| 42 |
+
|
| 43 |
+
<main class="flex-grow">
|
| 44 |
+
<!-- HOME (brief) -->
|
| 45 |
+
<section id="home" class="page-content active">
|
| 46 |
+
<div class="mx-auto max-w-7xl px-4 py-12">
|
| 47 |
+
<div class="text-center">
|
| 48 |
+
<h2 class="text-3xl font-bold">AI Prompt & Image Playground — Hugging Face</h2>
|
| 49 |
+
<p class="mt-3 text-gray-600 dark:text-gray-300">This demo uses the Hugging Face Inference API. Replace the client token with a backend proxy token before production.</p>
|
| 50 |
+
</div>
|
| 51 |
+
|
| 52 |
+
<!-- Prompt Ideator -->
|
| 53 |
+
<div class="mt-10 max-w-xl mx-auto">
|
| 54 |
+
<h3 class="text-xl font-semibold mb-3">✨ AI Prompt Ideator</h3>
|
| 55 |
+
<div class="flex gap-3">
|
| 56 |
+
<input id="prompt-input" type="text" placeholder="e.g., a cat astronaut on Mars" aria-label="Prompt input"
|
| 57 |
+
class="w-full rounded-lg border border-gray-300 p-3 bg-white dark:bg-gray-800" />
|
| 58 |
+
<button id="generate-prompt-btn" type="button" class="rounded-lg bg-sky-600 px-4 py-2 text-white font-semibold">
|
| 59 |
+
<span class="btn-text">Generate Prompt</span>
|
| 60 |
+
<span class="btn-spinner hidden ml-2">⏳</span>
|
| 61 |
+
</button>
|
| 62 |
+
</div>
|
| 63 |
+
<div id="prompt-result" class="mt-4 result-box hidden" role="status" aria-live="polite"></div>
|
| 64 |
+
</div>
|
| 65 |
+
|
| 66 |
+
<!-- Image Playground -->
|
| 67 |
+
<div class="mt-12 max-w-xl mx-auto">
|
| 68 |
+
<h3 class="text-xl font-semibold mb-3">✨ AI Image Playground</h3>
|
| 69 |
+
<div class="flex gap-3">
|
| 70 |
+
<input id="image-prompt-input" type="text" placeholder="e.g., futuristic city at sunset" aria-label="Image prompt input"
|
| 71 |
+
class="w-full rounded-lg border border-gray-300 p-3 bg-white dark:bg-gray-800" />
|
| 72 |
+
<button id="generate-image-btn" type="button" class="rounded-lg bg-sky-600 px-4 py-2 text-white font-semibold">
|
| 73 |
+
<span class="btn-text">Generate Image</span>
|
| 74 |
+
<span class="btn-spinner hidden ml-2">⏳</span>
|
| 75 |
+
</button>
|
| 76 |
+
</div>
|
| 77 |
+
|
| 78 |
+
<div id="image-loading" class="mt-6 hidden text-sm text-gray-600 dark:text-gray-300">
|
| 79 |
+
<div class="flex items-center gap-3">
|
| 80 |
+
<svg class="animate-spin h-6 w-6 text-sky-600" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
| 81 |
+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
| 82 |
+
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path>
|
| 83 |
+
</svg>
|
| 84 |
+
<span>Generating image — this may take 10–30s depending on the model.</span>
|
| 85 |
+
</div>
|
| 86 |
+
</div>
|
| 87 |
+
|
| 88 |
+
<div id="image-result" class="mt-6 result-box" role="status" aria-live="polite"></div>
|
| 89 |
+
</div>
|
| 90 |
+
|
| 91 |
+
</div>
|
| 92 |
+
</section>
|
| 93 |
+
|
| 94 |
+
<!-- SERVICES (placeholder) -->
|
| 95 |
+
<section id="services" class="page-content">
|
| 96 |
+
<div class="mx-auto max-w-7xl px-4 py-12">
|
| 97 |
+
<h2 class="text-2xl font-bold">Services</h2>
|
| 98 |
+
<p class="mt-3 text-gray-600 dark:text-gray-300">Sample content...</p>
|
| 99 |
+
</div>
|
| 100 |
+
</section>
|
| 101 |
+
|
| 102 |
+
<!-- PORTFOLIO (placeholder) -->
|
| 103 |
+
<section id="portfolio" class="page-content">
|
| 104 |
+
<div class="mx-auto max-w-7xl px-4 py-12">
|
| 105 |
+
<h2 class="text-2xl font-bold">Portfolio</h2>
|
| 106 |
+
<p class="mt-3 text-gray-600 dark:text-gray-300">Sample content...</p>
|
| 107 |
+
</div>
|
| 108 |
+
</section>
|
| 109 |
+
|
| 110 |
+
<!-- CONTACT (placeholder) -->
|
| 111 |
+
<section id="contact" class="page-content">
|
| 112 |
+
<div class="mx-auto max-w-7xl px-4 py-12">
|
| 113 |
+
<h2 class="text-2xl font-bold">Contact</h2>
|
| 114 |
+
<p class="mt-3 text-gray-600 dark:text-gray-300">Sample content...</p>
|
| 115 |
+
</div>
|
| 116 |
+
</section>
|
| 117 |
+
</main>
|
| 118 |
+
|
| 119 |
+
<footer class="border-t border-gray-200/50 dark:border-gray-700/50 bg-white/80 dark:bg-gray-900/80">
|
| 120 |
+
<div class="mx-auto max-w-7xl px-4 py-8 text-center text-sm text-gray-600 dark:text-gray-300">
|
| 121 |
+
© 2024 NeuralNomadAI — Hugging Face demo. Remember to proxy your API key on the server.
|
| 122 |
+
</div>
|
| 123 |
+
</footer>
|
| 124 |
+
</div>
|
| 125 |
+
|
| 126 |
+
<!-- JS: huggingface API integration + UI handling -->
|
| 127 |
+
<script>
|
| 128 |
+
// -------------------------
|
| 129 |
+
// IMPORTANT (security):
|
| 130 |
+
// Do NOT put real HF tokens in client-side code for production.
|
| 131 |
+
// For quick local testing you can paste a short-lived token here,
|
| 132 |
+
// but the recommended pattern is:
|
| 133 |
+
// - Create a small backend endpoint (e.g. /api/hf/generate)
|
| 134 |
+
// - The backend attaches your HF token to the request and forwards it to HF
|
| 135 |
+
// -------------------------
|
| 136 |
+
|
| 137 |
+
// If you still want to test client-side (ONLY FOR LOCAL TESTING), put a token here:
|
| 138 |
+
// const HF_TOKEN = 'HF_API_TOKEN_HERE';
|
| 139 |
+
// Otherwise set HF_TOKEN to empty and call a backend endpoint instead.
|
| 140 |
+
const HF_TOKEN = ''; // <-- REPLACE WITH '' FOR PRODUCTION. Use backend proxy.
|
| 141 |
+
|
| 142 |
+
// Backend proxy settings (recommended)
|
| 143 |
+
// If you implement a backend, set PROXY_BASE to your server endpoint:
|
| 144 |
+
// e.g. const PROXY_BASE = '/api/hf'; and implement endpoints /api/hf/text and /api/hf/image
|
| 145 |
+
const PROXY_BASE = ''; // e.g. '/api/hf' (leave empty to call HF directly)
|
| 146 |
+
|
| 147 |
+
// Model choices (you can change these)
|
| 148 |
+
// Text generation: use a text generation model (make sure to check the model's capabilities)
|
| 149 |
+
const HF_TEXT_MODEL = 'gpt2'; // small example; swap with a better model for real usage
|
| 150 |
+
// Image generation: choose a model that returns image binary, e.g., "stabilityai/stable-diffusion-2"
|
| 151 |
+
const HF_IMAGE_MODEL = 'stabilityai/stable-diffusion-2';
|
| 152 |
+
|
| 153 |
+
// Utilities
|
| 154 |
+
const escapeHtml = (unsafe) => {
|
| 155 |
+
if (unsafe === null || unsafe === undefined) return '';
|
| 156 |
+
return String(unsafe)
|
| 157 |
+
.replace(/&/g, '&')
|
| 158 |
+
.replace(/</g, '<')
|
| 159 |
+
.replace(/>/g, '>')
|
| 160 |
+
.replace(/"/g, '"')
|
| 161 |
+
.replace(/'/g, ''');
|
| 162 |
+
};
|
| 163 |
+
|
| 164 |
+
const formatSafeHtml = (text) => {
|
| 165 |
+
let out = escapeHtml(text);
|
| 166 |
+
out = out.replace(/\*\*(.+?)\*\*/g, (m, p1) => `<strong>${p1}</strong>`);
|
| 167 |
+
out = out.replace(/\r\n|\r|\n/g, '<br>');
|
| 168 |
+
return out;
|
| 169 |
+
};
|
| 170 |
+
|
| 171 |
+
// DOM
|
| 172 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 173 |
+
const promptInput = document.getElementById('prompt-input');
|
| 174 |
+
const generatePromptBtn = document.getElementById('generate-prompt-btn');
|
| 175 |
+
const promptResult = document.getElementById('prompt-result');
|
| 176 |
+
|
| 177 |
+
const imagePromptInput = document.getElementById('image-prompt-input');
|
| 178 |
+
const generateImageBtn = document.getElementById('generate-image-btn');
|
| 179 |
+
const imageLoading = document.getElementById('image-loading');
|
| 180 |
+
const imageResult = document.getElementById('image-result');
|
| 181 |
+
|
| 182 |
+
// Small helpers
|
| 183 |
+
const setButtonLoading = (button, loading = true, loadingText = 'Generating...') => {
|
| 184 |
+
if (!button) return;
|
| 185 |
+
const btnTextNode = button.querySelector('.btn-text');
|
| 186 |
+
const spinner = button.querySelector('.btn-spinner');
|
| 187 |
+
button.disabled = loading;
|
| 188 |
+
button.classList.toggle('opacity-60', loading);
|
| 189 |
+
button.setAttribute('aria-busy', String(loading));
|
| 190 |
+
if (btnTextNode && loading) btnTextNode.textContent = loadingText;
|
| 191 |
+
if (btnTextNode && !loading) {
|
| 192 |
+
if (button.id === 'generate-prompt-btn') btnTextNode.textContent = 'Generate Prompt';
|
| 193 |
+
if (button.id === 'generate-image-btn') btnTextNode.textContent = 'Generate Image';
|
| 194 |
}
|
| 195 |
+
if (spinner) spinner.classList.toggle('hidden', !loading);
|
| 196 |
+
};
|
| 197 |
+
|
| 198 |
+
const showError = (el, message) => {
|
| 199 |
+
if (!el) return;
|
| 200 |
+
el.classList.remove('hidden');
|
| 201 |
+
el.innerHTML = `<div class="p-3 rounded bg-red-50 text-red-700 dark:bg-red-900/30">${escapeHtml(message)}</div>`;
|
| 202 |
+
};
|
| 203 |
+
|
| 204 |
+
const showHtml = (el, html) => {
|
| 205 |
+
if (!el) return;
|
| 206 |
+
el.classList.remove('hidden');
|
| 207 |
+
el.innerHTML = html;
|
| 208 |
+
};
|
| 209 |
+
|
| 210 |
+
// Generic function to call Hugging Face Inference API for text
|
| 211 |
+
// If PROXY_BASE is set, the code will call PROXY_BASE + '/text' instead.
|
| 212 |
+
// The backend should forward the request to HF with the Authorization header.
|
| 213 |
+
async function hfTextGenerate(prompt) {
|
| 214 |
+
if (!prompt) throw new Error('Empty prompt');
|
| 215 |
+
const payload = { inputs: prompt, options: { wait_for_model: true } };
|
| 216 |
+
|
| 217 |
+
if (PROXY_BASE) {
|
| 218 |
+
// call your backend proxy (recommended)
|
| 219 |
+
const resp = await fetch(`${PROXY_BASE}/text`, {
|
| 220 |
+
method: 'POST',
|
| 221 |
+
headers: { 'Content-Type': 'application/json' },
|
| 222 |
+
body: JSON.stringify({ model: HF_TEXT_MODEL, payload }),
|
| 223 |
+
});
|
| 224 |
+
if (!resp.ok) throw new Error(`Proxy error: ${resp.status} ${await resp.text()}`);
|
| 225 |
+
return resp.json();
|
| 226 |
}
|
| 227 |
+
|
| 228 |
+
// Direct client-side call to HF Inference
|
| 229 |
+
if (!HF_TOKEN) throw new Error('No HF token set (use a backend proxy in production)');
|
| 230 |
+
|
| 231 |
+
const url = `https://api-inference.huggingface.co/models/${encodeURIComponent(HF_TEXT_MODEL)}`;
|
| 232 |
+
const resp = await fetch(url, {
|
| 233 |
+
method: 'POST',
|
| 234 |
+
headers: {
|
| 235 |
+
Authorization: `Bearer ${HF_TOKEN}`,
|
| 236 |
+
'Content-Type': 'application/json',
|
| 237 |
+
},
|
| 238 |
+
body: JSON.stringify(payload),
|
| 239 |
+
});
|
| 240 |
+
|
| 241 |
+
if (!resp.ok) {
|
| 242 |
+
const txt = await resp.text().catch(() => '');
|
| 243 |
+
throw new Error(`Hugging Face API error: ${resp.status} ${txt}`);
|
| 244 |
}
|
| 245 |
+
|
| 246 |
+
return resp.json();
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
// Generic function to call Hugging Face Inference API for images
|
| 250 |
+
// Many HF image models return binary image data (image/png). We handle binary responses and JSON fallbacks.
|
| 251 |
+
async function hfImageGenerate(prompt) {
|
| 252 |
+
if (!prompt) throw new Error('Empty prompt');
|
| 253 |
+
|
| 254 |
+
if (PROXY_BASE) {
|
| 255 |
+
const resp = await fetch(`${PROXY_BASE}/image`, {
|
| 256 |
+
method: 'POST',
|
| 257 |
+
headers: { 'Content-Type': 'application/json' },
|
| 258 |
+
body: JSON.stringify({ model: HF_IMAGE_MODEL, prompt }),
|
| 259 |
+
});
|
| 260 |
+
if (!resp.ok) throw new Error(`Proxy error: ${resp.status} ${await resp.text()}`);
|
| 261 |
+
// Proxy might forward binary image or JSON with base64; try to detect
|
| 262 |
+
const contentType = resp.headers.get('content-type') || '';
|
| 263 |
+
if (contentType.startsWith('image/')) {
|
| 264 |
+
const blob = await resp.blob();
|
| 265 |
+
return { blob };
|
| 266 |
+
} else {
|
| 267 |
+
return resp.json();
|
| 268 |
+
}
|
| 269 |
}
|
| 270 |
+
|
| 271 |
+
// Direct client-side call to HF Inference (NOT RECOMMENDED)
|
| 272 |
+
if (!HF_TOKEN) throw new Error('No HF token set (use a backend proxy in production)');
|
| 273 |
+
|
| 274 |
+
const url = `https://api-inference.huggingface.co/models/${encodeURIComponent(HF_IMAGE_MODEL)}`;
|
| 275 |
+
const resp = await fetch(url, {
|
| 276 |
+
method: 'POST',
|
| 277 |
+
headers: {
|
| 278 |
+
Authorization: `Bearer ${HF_TOKEN}`,
|
| 279 |
+
'Content-Type': 'application/json',
|
| 280 |
+
},
|
| 281 |
+
// For some image models HF expects {"inputs":"<prompt>"} or a specialized payload
|
| 282 |
+
body: JSON.stringify({ inputs: prompt }),
|
| 283 |
+
});
|
| 284 |
+
|
| 285 |
+
if (!resp.ok) {
|
| 286 |
+
const txt = await resp.text().catch(() => '');
|
| 287 |
+
throw new Error(`Hugging Face image error: ${resp.status} ${txt}`);
|
| 288 |
}
|
| 289 |
+
|
| 290 |
+
const contentType = resp.headers.get('content-type') || '';
|
| 291 |
+
if (contentType.startsWith('image/')) {
|
| 292 |
+
const blob = await resp.blob();
|
| 293 |
+
return { blob };
|
| 294 |
+
} else {
|
| 295 |
+
// JSON response (could contain base64 or URLs); parse it
|
| 296 |
+
const json = await resp.json().catch(() => null);
|
| 297 |
+
return json;
|
| 298 |
}
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
// Handlers
|
| 302 |
+
const handlePromptGeneration = async () => {
|
| 303 |
+
const input = (promptInput.value || '').trim();
|
| 304 |
+
if (!input) {
|
| 305 |
+
showError(promptResult, 'Please enter a short idea to expand into a prompt.');
|
| 306 |
+
return;
|
| 307 |
}
|
| 308 |
+
promptResult.classList.add('hidden');
|
| 309 |
+
setButtonLoading(generatePromptBtn, true, 'Generating...');
|
| 310 |
+
try {
|
| 311 |
+
const systemPrompt = `You are a senior prompt engineer. Expand the user's short idea into a detailed, artistic prompt suitable for image generation. The idea: "${input}"`;
|
| 312 |
+
// Use HF text generation
|
| 313 |
+
const resp = await hfTextGenerate(systemPrompt);
|
| 314 |
+
// Response shapes vary: HF text models often return an array like [{generated_text: "..."}]
|
| 315 |
+
let text = null;
|
| 316 |
+
if (Array.isArray(resp) && resp.length > 0 && resp[0].generated_text) {
|
| 317 |
+
text = resp[0].generated_text;
|
| 318 |
+
} else if (resp.generated_text) {
|
| 319 |
+
text = resp.generated_text;
|
| 320 |
+
} else if (typeof resp === 'string') {
|
| 321 |
+
text = resp;
|
| 322 |
+
} else if (Array.isArray(resp) && typeof resp[0] === 'string') {
|
| 323 |
+
text = resp[0];
|
| 324 |
+
} else if (resp && resp[0] && resp[0].text) {
|
| 325 |
+
text = resp[0].text;
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
if (!text) {
|
| 329 |
+
showError(promptResult, 'No text returned by the model (unexpected response shape). Check console for raw output.');
|
| 330 |
+
console.debug('HF text response (raw):', resp);
|
| 331 |
+
} else {
|
| 332 |
+
const safe = formatSafeHtml(text);
|
| 333 |
+
showHtml(promptResult, safe);
|
| 334 |
+
}
|
| 335 |
+
} catch (err) {
|
| 336 |
+
console.error('Prompt generation error:', err);
|
| 337 |
+
showError(promptResult, `Error: ${err.message || err}`);
|
| 338 |
+
} finally {
|
| 339 |
+
setButtonLoading(generatePromptBtn, false);
|
| 340 |
}
|
| 341 |
+
};
|
| 342 |
+
|
| 343 |
+
const handleImageGeneration = async () => {
|
| 344 |
+
const prompt = (imagePromptInput.value || '').trim();
|
| 345 |
+
if (!prompt) {
|
| 346 |
+
showError(imageResult, 'Please enter an image prompt to generate an image.');
|
| 347 |
+
return;
|
| 348 |
}
|
| 349 |
+
imageResult.innerHTML = '';
|
| 350 |
+
imageLoading.classList.remove('hidden');
|
| 351 |
+
setButtonLoading(generateImageBtn, true, 'Generating...');
|
| 352 |
+
try {
|
| 353 |
+
const resp = await hfImageGenerate(prompt);
|
| 354 |
+
|
| 355 |
+
// If backend or HF returned binary blob
|
| 356 |
+
if (resp && resp.blob) {
|
| 357 |
+
const url = URL.createObjectURL(resp.blob);
|
| 358 |
+
const img = document.createElement('img');
|
| 359 |
+
img.src = url;
|
| 360 |
+
img.alt = `AI generated: ${prompt}`;
|
| 361 |
+
img.loading = 'lazy';
|
| 362 |
+
img.decoding = 'async';
|
| 363 |
+
img.className = 'rounded-lg shadow-lg mx-auto';
|
| 364 |
+
imageResult.appendChild(img);
|
| 365 |
+
return;
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
// HF may return JSON containing base64 or an array of output URLs.
|
| 369 |
+
// Common shapes:
|
| 370 |
+
// - [{generated_text: "..."}] (unlikely for images)
|
| 371 |
+
// - { error: "..." }
|
| 372 |
+
// - [{image_base64: "..."}, ...] or { images: ["data:image/png;..."] }
|
| 373 |
+
// - [{ "generated_image": "<base64>" }]
|
| 374 |
+
// We'll try a few possibilities defensively:
|
| 375 |
+
|
| 376 |
+
// If it's an array with objects containing 'image' or 'base64' fields
|
| 377 |
+
if (Array.isArray(resp)) {
|
| 378 |
+
// try to find a base64 string
|
| 379 |
+
const obj = resp.find(r => (r.image || r.base64 || r.image_base64 || r.generated_image));
|
| 380 |
+
const val = obj && (obj.image || obj.base64 || obj.image_base64 || obj.generated_image);
|
| 381 |
+
if (val && typeof val === 'string') {
|
| 382 |
+
// if it already begins with data:, use directly; else assume base64 png
|
| 383 |
+
const src = val.startsWith('data:') ? val : `data:image/png;base64,${val}`;
|
| 384 |
+
const img = document.createElement('img');
|
| 385 |
+
img.src = src;
|
| 386 |
+
img.alt = `AI generated: ${prompt}`;
|
| 387 |
+
img.loading = 'lazy';
|
| 388 |
+
img.decoding = 'async';
|
| 389 |
+
img.className = 'rounded-lg shadow-lg mx-auto';
|
| 390 |
+
imageResult.appendChild(img);
|
| 391 |
+
return;
|
| 392 |
}
|
| 393 |
+
}
|
| 394 |
+
|
| 395 |
+
// If resp.images is an array of data URLs or URLs
|
| 396 |
+
if (resp && (resp.images || resp.output)) {
|
| 397 |
+
const arr = resp.images || resp.output;
|
| 398 |
+
if (Array.isArray(arr) && arr.length > 0) {
|
| 399 |
+
const imageUrl = arr[0];
|
| 400 |
+
const img = document.createElement('img');
|
| 401 |
+
img.src = imageUrl;
|
| 402 |
+
img.alt = `AI generated: ${prompt}`;
|
| 403 |
+
img.loading = 'lazy';
|
| 404 |
+
img.decoding = 'async';
|
| 405 |
+
img.className = 'rounded-lg shadow-lg mx-auto';
|
| 406 |
+
imageResult.appendChild(img);
|
| 407 |
+
return;
|
| 408 |
}
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
// If resp contains a base64 string in top-level 'generated_image' or 'b64_json'
|
| 412 |
+
const b64 = resp && (resp.generated_image || resp.b64_json || resp.image_base64 || resp.base64);
|
| 413 |
+
if (b64 && typeof b64 === 'string') {
|
| 414 |
+
const src = b64.startsWith('data:') ? b64 : `data:image/png;base64,${b64}`;
|
| 415 |
+
const img = document.createElement('img');
|
| 416 |
+
img.src = src;
|
| 417 |
+
img.alt = `AI generated: ${prompt}`;
|
| 418 |
+
img.loading = 'lazy';
|
| 419 |
+
img.decoding = 'async';
|
| 420 |
+
img.className = 'rounded-lg shadow-lg mx-auto';
|
| 421 |
+
imageResult.appendChild(img);
|
| 422 |
+
return;
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
// As last resort, show the raw JSON for debugging
|
| 426 |
+
showHtml(imageResult, `<pre class="p-3 bg-white/80 dark:bg-gray-800/70 rounded">${escapeHtml(JSON.stringify(resp, null, 2))}</pre>`);
|
| 427 |
+
console.debug('HF image response (raw):', resp);
|
| 428 |
+
} catch (err) {
|
| 429 |
+
console.error('Image generation error:', err);
|
| 430 |
+
showError(imageResult, `Error: ${err.message || err}`);
|
| 431 |
+
} finally {
|
| 432 |
+
imageLoading.classList.add('hidden');
|
| 433 |
+
setButtonLoading(generateImageBtn, false);
|
| 434 |
}
|
| 435 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 436 |
|
| 437 |
+
// Attach listeners
|
| 438 |
+
generatePromptBtn.addEventListener('click', handlePromptGeneration);
|
| 439 |
+
generateImageBtn.addEventListener('click', handleImageGeneration);
|
| 440 |
+
|
| 441 |
+
// Navigation (simple)
|
| 442 |
+
const navLinks = document.querySelectorAll('[data-page]');
|
| 443 |
+
const pages = document.querySelectorAll('.page-content');
|
| 444 |
+
const showPage = (id) => {
|
| 445 |
+
pages.forEach(p => p.classList.remove('active'));
|
| 446 |
+
const el = document.getElementById(id);
|
| 447 |
+
if (el) el.classList.add('active');
|
| 448 |
+
};
|
| 449 |
+
navLinks.forEach(link => {
|
| 450 |
+
link.addEventListener('click', (e) => {
|
| 451 |
+
e.preventDefault();
|
| 452 |
+
const page = link.getAttribute('data-page');
|
| 453 |
+
if (page) {
|
| 454 |
+
history.pushState({ page }, '', `#${page}`);
|
| 455 |
+
showPage(page);
|
| 456 |
+
}
|
| 457 |
+
});
|
| 458 |
+
});
|
| 459 |
+
window.addEventListener('popstate', (ev) => {
|
| 460 |
+
const page = (ev.state && ev.state.page) || (location.hash && location.hash.substring(1)) || 'home';
|
| 461 |
+
showPage(page);
|
| 462 |
+
});
|
| 463 |
+
});
|
| 464 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 465 |
</body>
|
| 466 |
+
</html>
|