Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import os
|
| 2 |
import gc
|
| 3 |
import io
|
|
@@ -21,11 +22,7 @@ from fastapi.responses import HTMLResponse, JSONResponse, FileResponse
|
|
| 21 |
|
| 22 |
from diffusers import Flux2KleinPipeline, AutoencoderKLFlux2
|
| 23 |
|
| 24 |
-
|
| 25 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 26 |
-
|
| 27 |
-
MAX_SEED = np.iinfo(np.int32).max
|
| 28 |
-
MAX_IMAGE_SIZE = 1024
|
| 29 |
|
| 30 |
BASE_DIR = Path(__file__).resolve().parent
|
| 31 |
STATIC_DIR = BASE_DIR / "static"
|
|
@@ -35,10 +32,16 @@ EXAMPLES_DIR = BASE_DIR / "examples"
|
|
| 35 |
STATIC_DIR.mkdir(exist_ok=True)
|
| 36 |
OUTPUT_DIR.mkdir(exist_ok=True)
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
if torch.cuda.is_available():
|
| 39 |
DEVICE_LABEL = torch.cuda.get_device_name(torch.cuda.current_device()).lower()
|
| 40 |
else:
|
| 41 |
-
DEVICE_LABEL =
|
| 42 |
|
| 43 |
print("Loading 4B Distilled model (Standard VAE)...")
|
| 44 |
pipe_standard = Flux2KleinPipeline.from_pretrained(
|
|
@@ -65,6 +68,19 @@ pipe_lock_standard = threading.Lock()
|
|
| 65 |
pipe_lock_small = threading.Lock()
|
| 66 |
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
def calc_dimensions(pil_img: Image.Image):
|
| 69 |
iw, ih = pil_img.size
|
| 70 |
aspect = iw / ih
|
|
@@ -79,27 +95,14 @@ def calc_dimensions(pil_img: Image.Image):
|
|
| 79 |
return new_width, new_height
|
| 80 |
|
| 81 |
|
| 82 |
-
def parse_and_resize_images(
|
| 83 |
-
if input_images is None:
|
| 84 |
-
return None
|
| 85 |
raw_list = []
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
for item in input_images:
|
| 93 |
-
try:
|
| 94 |
-
src = item[0] if isinstance(item, tuple) else item
|
| 95 |
-
if isinstance(src, str):
|
| 96 |
-
raw_list.append(Image.open(src).convert("RGB"))
|
| 97 |
-
elif isinstance(src, Image.Image):
|
| 98 |
-
raw_list.append(src.convert("RGB"))
|
| 99 |
-
elif hasattr(src, "name"):
|
| 100 |
-
raw_list.append(Image.open(src.name).convert("RGB"))
|
| 101 |
-
except Exception as e:
|
| 102 |
-
print(f"Skipping invalid image: {e}")
|
| 103 |
if not raw_list:
|
| 104 |
return None
|
| 105 |
return [img.resize((width, height), Image.LANCZOS) for img in raw_list]
|
|
@@ -112,65 +115,58 @@ def run_pipeline(pipe, lock, kwargs, seed):
|
|
| 112 |
return result
|
| 113 |
|
| 114 |
|
| 115 |
-
def
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
|
| 121 |
-
|
| 122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
path = OUTPUT_DIR / filename
|
| 124 |
-
|
| 125 |
-
|
|
|
|
| 126 |
|
| 127 |
|
| 128 |
@spaces.GPU(duration=120)
|
| 129 |
-
def
|
| 130 |
-
prompt,
|
| 131 |
-
image_paths=None,
|
| 132 |
-
seed=42,
|
| 133 |
-
randomize_seed=False,
|
| 134 |
-
width=1024,
|
| 135 |
-
height=1024,
|
| 136 |
-
num_inference_steps=4,
|
| 137 |
-
guidance_scale=1.0,
|
| 138 |
-
):
|
| 139 |
gc.collect()
|
| 140 |
if torch.cuda.is_available():
|
| 141 |
torch.cuda.empty_cache()
|
| 142 |
|
| 143 |
-
if not prompt or not str(prompt).strip():
|
| 144 |
-
raise ValueError("Please enter a prompt.")
|
| 145 |
-
|
| 146 |
-
if isinstance(seed, str):
|
| 147 |
-
seed = int(seed)
|
| 148 |
-
if isinstance(randomize_seed, str):
|
| 149 |
-
randomize_seed = randomize_seed.lower() == "true"
|
| 150 |
-
if isinstance(width, str):
|
| 151 |
-
width = int(width)
|
| 152 |
-
if isinstance(height, str):
|
| 153 |
-
height = int(height)
|
| 154 |
-
if isinstance(num_inference_steps, str):
|
| 155 |
-
num_inference_steps = int(num_inference_steps)
|
| 156 |
-
if isinstance(guidance_scale, str):
|
| 157 |
-
guidance_scale = float(guidance_scale)
|
| 158 |
-
|
| 159 |
if randomize_seed:
|
| 160 |
seed = random.randint(0, MAX_SEED)
|
| 161 |
|
| 162 |
image_list = None
|
| 163 |
if image_paths:
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
if pil_images:
|
| 172 |
-
width, height = calc_dimensions(pil_images[0])
|
| 173 |
-
image_list = [img.resize((width, height), Image.LANCZOS) for img in pil_images]
|
| 174 |
|
| 175 |
width = max(256, min(MAX_IMAGE_SIZE, round(int(width) / 8) * 8))
|
| 176 |
height = max(256, min(MAX_IMAGE_SIZE, round(int(height) / 8) * 8))
|
|
@@ -179,7 +175,7 @@ def infer(
|
|
| 179 |
prompt=prompt,
|
| 180 |
height=height,
|
| 181 |
width=width,
|
| 182 |
-
num_inference_steps=
|
| 183 |
guidance_scale=guidance_scale,
|
| 184 |
)
|
| 185 |
if image_list is not None:
|
|
@@ -200,44 +196,6 @@ def infer(
|
|
| 200 |
return out_standard, out_small, seed
|
| 201 |
|
| 202 |
|
| 203 |
-
def get_example_items():
|
| 204 |
-
example_prompts = {
|
| 205 |
-
"1.jpg": "Change the weather to stormy.",
|
| 206 |
-
"2.jpg": "Transform the scene into a snowy winter day while preserving the original subject identity, framing, and composition.",
|
| 207 |
-
"3.jpg": "Relight the image with soft golden sunset lighting while keeping all structures and subject details consistent.",
|
| 208 |
-
"4.jpg": "Make the texture high-resolution.",
|
| 209 |
-
}
|
| 210 |
-
items = []
|
| 211 |
-
if EXAMPLES_DIR.exists():
|
| 212 |
-
for name in sorted(os.listdir(EXAMPLES_DIR)):
|
| 213 |
-
if name.lower().endswith((".png", ".jpg", ".jpeg", ".webp")):
|
| 214 |
-
items.append({
|
| 215 |
-
"file": name,
|
| 216 |
-
"url": f"/example-file/{name}",
|
| 217 |
-
"prompt": example_prompts.get(name, "Edit this image while preserving composition."),
|
| 218 |
-
})
|
| 219 |
-
return items
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
app = Server()
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
@app.get("/example-file/{filename}")
|
| 226 |
-
async def example_file(filename: str):
|
| 227 |
-
path = EXAMPLES_DIR / filename
|
| 228 |
-
if not path.exists():
|
| 229 |
-
return JSONResponse({"error": "Example not found"}, status_code=404)
|
| 230 |
-
return FileResponse(path)
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
@app.get("/download/{filename}")
|
| 234 |
-
async def download_file(filename: str):
|
| 235 |
-
path = OUTPUT_DIR / filename
|
| 236 |
-
if not path.exists():
|
| 237 |
-
return JSONResponse({"error": "File not found"}, status_code=404)
|
| 238 |
-
return FileResponse(path, filename=filename, media_type="image/png")
|
| 239 |
-
|
| 240 |
-
|
| 241 |
@app.post("/api/compare")
|
| 242 |
async def compare_images(
|
| 243 |
prompt: str = Form(...),
|
|
@@ -263,15 +221,15 @@ async def compare_images(
|
|
| 263 |
temp_paths.append(str(temp_path))
|
| 264 |
image_paths.append(str(temp_path))
|
| 265 |
|
| 266 |
-
out_standard, out_small, used_seed =
|
|
|
|
| 267 |
prompt=prompt,
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
guidance_scale=guidance_scale,
|
| 275 |
)
|
| 276 |
|
| 277 |
std_filename = save_image(out_standard, prefix="standard")
|
|
@@ -314,256 +272,346 @@ async def homepage(request: Request):
|
|
| 314 |
<head>
|
| 315 |
<meta charset="UTF-8" />
|
| 316 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 317 |
-
<title>FLUX.2
|
| 318 |
<style>
|
| 319 |
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;500;700&family=Ubuntu+Mono:wght@400;700&display=swap');
|
| 320 |
|
| 321 |
:root {{
|
| 322 |
-
--bg: #
|
| 323 |
-
--
|
| 324 |
-
--
|
| 325 |
-
--surface
|
| 326 |
-
--
|
| 327 |
-
--
|
| 328 |
-
--
|
| 329 |
-
--
|
| 330 |
-
--text
|
|
|
|
|
|
|
| 331 |
--orange: #e95420;
|
| 332 |
-
--orange-hover: #
|
|
|
|
| 333 |
--orange-soft: rgba(233,84,32,0.15);
|
| 334 |
--orange-border: rgba(233,84,32,0.4);
|
| 335 |
-
--purple: #77216f;
|
| 336 |
-
--purple-light: #ad7fa8;
|
| 337 |
--green: #4caf50;
|
| 338 |
--green-soft: rgba(76,175,80,0.15);
|
| 339 |
-
--input-bg: #
|
| 340 |
-
--
|
| 341 |
-
--
|
|
|
|
|
|
|
| 342 |
}}
|
| 343 |
|
| 344 |
-
*
|
| 345 |
-
box-sizing: border-box;
|
| 346 |
-
margin: 0;
|
| 347 |
-
padding: 0;
|
| 348 |
-
}}
|
| 349 |
|
| 350 |
html, body {{
|
| 351 |
-
background: var(--bg);
|
| 352 |
color: var(--text);
|
| 353 |
-
font-family:
|
| 354 |
-
min-height:
|
| 355 |
overflow-x: hidden;
|
| 356 |
}}
|
| 357 |
|
| 358 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
.topbar {{
|
| 360 |
height: 52px;
|
| 361 |
-
background: #
|
| 362 |
-
border-bottom: 1px solid
|
| 363 |
display: flex;
|
| 364 |
align-items: center;
|
| 365 |
-
padding: 0
|
| 366 |
-
gap:
|
|
|
|
|
|
|
|
|
|
| 367 |
}}
|
| 368 |
|
| 369 |
-
.topbar-
|
| 370 |
display: flex;
|
| 371 |
-
|
| 372 |
-
gap: 10px;
|
| 373 |
-
font-weight: 700;
|
| 374 |
-
font-size: 15px;
|
| 375 |
-
color: var(--text);
|
| 376 |
-
letter-spacing: 0.01em;
|
| 377 |
}}
|
| 378 |
|
| 379 |
-
.
|
| 380 |
-
width:
|
| 381 |
-
height:
|
| 382 |
-
border-radius: 50%
|
| 383 |
-
background: var(--orange);
|
| 384 |
flex-shrink: 0;
|
| 385 |
}}
|
| 386 |
|
| 387 |
-
.
|
| 388 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 389 |
}}
|
| 390 |
|
| 391 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
font-size: 12px;
|
| 393 |
-
font-
|
| 394 |
-
color: var(--text-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 398 |
}}
|
| 399 |
|
| 400 |
-
|
| 401 |
-
.
|
| 402 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 403 |
margin: 0 auto;
|
| 404 |
-
padding:
|
|
|
|
|
|
|
|
|
|
| 405 |
}}
|
| 406 |
|
| 407 |
-
/* ──
|
| 408 |
.hero {{
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
border-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 412 |
}}
|
| 413 |
|
|
|
|
|
|
|
| 414 |
.hero-eyebrow {{
|
| 415 |
-
font-family: var(--mono);
|
| 416 |
font-size: 12px;
|
| 417 |
-
|
| 418 |
-
|
|
|
|
|
|
|
| 419 |
text-transform: uppercase;
|
| 420 |
-
margin-bottom: 10px;
|
| 421 |
}}
|
| 422 |
|
| 423 |
.hero-title {{
|
| 424 |
-
font-size:
|
| 425 |
font-weight: 700;
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
}}
|
| 430 |
|
| 431 |
-
.hero-title span {{
|
| 432 |
-
color: var(--orange);
|
| 433 |
-
}}
|
| 434 |
|
| 435 |
.hero-desc {{
|
| 436 |
-
font-size:
|
| 437 |
color: var(--text-dim);
|
| 438 |
line-height: 1.6;
|
| 439 |
-
max-width:
|
| 440 |
}}
|
| 441 |
|
| 442 |
-
.hero-
|
| 443 |
display: flex;
|
| 444 |
-
flex-wrap: wrap;
|
| 445 |
gap: 8px;
|
| 446 |
-
|
|
|
|
| 447 |
}}
|
| 448 |
|
| 449 |
-
.
|
| 450 |
display: inline-flex;
|
| 451 |
align-items: center;
|
| 452 |
gap: 6px;
|
| 453 |
-
|
| 454 |
-
|
| 455 |
font-size: 12px;
|
| 456 |
font-weight: 500;
|
| 457 |
-
font-family:
|
| 458 |
-
border: 1px solid
|
| 459 |
-
color: var(--text-dim);
|
| 460 |
-
background: var(--surface-2);
|
| 461 |
}}
|
| 462 |
|
| 463 |
-
.
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
border-color: var(--orange-border);
|
| 467 |
-
}}
|
| 468 |
|
| 469 |
-
/* ──
|
| 470 |
.main-grid {{
|
| 471 |
display: grid;
|
| 472 |
-
grid-template-columns:
|
| 473 |
gap: 20px;
|
| 474 |
align-items: start;
|
| 475 |
}}
|
| 476 |
|
| 477 |
-
/* ──
|
| 478 |
.panel {{
|
| 479 |
background: var(--surface);
|
| 480 |
border: 1px solid var(--border);
|
|
|
|
|
|
|
|
|
|
| 481 |
}}
|
| 482 |
|
| 483 |
.panel-header {{
|
| 484 |
-
height:
|
|
|
|
| 485 |
border-bottom: 1px solid var(--border);
|
| 486 |
display: flex;
|
| 487 |
align-items: center;
|
| 488 |
-
justify-content: space-between;
|
| 489 |
padding: 0 16px;
|
| 490 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 491 |
}}
|
| 492 |
|
| 493 |
-
.panel-title {{
|
| 494 |
font-size: 13px;
|
| 495 |
font-weight: 700;
|
| 496 |
-
|
| 497 |
-
letter-spacing: 0.
|
| 498 |
text-transform: uppercase;
|
| 499 |
-
|
| 500 |
}}
|
| 501 |
|
| 502 |
-
.panel-
|
| 503 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 504 |
}}
|
| 505 |
|
| 506 |
-
|
| 507 |
-
|
| 508 |
display: flex;
|
| 509 |
flex-direction: column;
|
| 510 |
gap: 14px;
|
| 511 |
}}
|
| 512 |
|
| 513 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 514 |
display: flex;
|
| 515 |
-
|
| 516 |
gap: 6px;
|
| 517 |
}}
|
| 518 |
|
| 519 |
-
.label {{
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
color: var(--text-muted);
|
| 526 |
}}
|
| 527 |
|
| 528 |
-
.hint {{
|
| 529 |
-
font-size:
|
| 530 |
color: var(--text-muted);
|
| 531 |
line-height: 1.5;
|
| 532 |
}}
|
| 533 |
|
| 534 |
-
textarea, input,
|
| 535 |
-
font-family: var(--sans);
|
| 536 |
-
}}
|
| 537 |
-
|
| 538 |
-
.input, .textarea {{
|
| 539 |
width: 100%;
|
| 540 |
background: var(--input-bg);
|
| 541 |
-
border: 1px solid var(--border
|
|
|
|
| 542 |
color: var(--text);
|
| 543 |
-
|
| 544 |
-
padding: 10px 12px;
|
| 545 |
font-size: 14px;
|
| 546 |
-
|
|
|
|
| 547 |
}}
|
| 548 |
|
| 549 |
-
|
| 550 |
-
border-color: var(--
|
| 551 |
}}
|
| 552 |
|
| 553 |
-
|
|
|
|
| 554 |
min-height: 90px;
|
| 555 |
resize: vertical;
|
| 556 |
line-height: 1.55;
|
| 557 |
}}
|
| 558 |
|
| 559 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 560 |
.upload-zone {{
|
| 561 |
background: var(--input-bg);
|
| 562 |
-
border:
|
| 563 |
-
|
|
|
|
| 564 |
cursor: pointer;
|
| 565 |
-
|
| 566 |
-
|
|
|
|
|
|
|
|
|
|
| 567 |
}}
|
| 568 |
|
| 569 |
.upload-zone.dragover {{
|
|
@@ -571,184 +619,232 @@ async def homepage(request: Request):
|
|
| 571 |
background: var(--orange-soft);
|
| 572 |
}}
|
| 573 |
|
| 574 |
-
.upload-zone input[type="file"] {{
|
| 575 |
-
display: none;
|
| 576 |
-
}}
|
| 577 |
|
| 578 |
.upload-placeholder {{
|
| 579 |
-
|
| 580 |
display: flex;
|
| 581 |
flex-direction: column;
|
| 582 |
align-items: center;
|
| 583 |
justify-content: center;
|
| 584 |
gap: 10px;
|
| 585 |
-
padding: 20px;
|
| 586 |
text-align: center;
|
| 587 |
cursor: pointer;
|
| 588 |
-
background: transparent;
|
| 589 |
border: none;
|
| 590 |
-
|
| 591 |
width: 100%;
|
|
|
|
| 592 |
}}
|
| 593 |
|
| 594 |
.upload-icon-wrap {{
|
| 595 |
width: 48px;
|
| 596 |
height: 48px;
|
| 597 |
-
border: 1px solid var(--border);
|
| 598 |
background: var(--surface-2);
|
|
|
|
|
|
|
| 599 |
display: flex;
|
| 600 |
align-items: center;
|
| 601 |
justify-content: center;
|
| 602 |
color: var(--orange);
|
| 603 |
-
flex-shrink: 0;
|
| 604 |
}}
|
| 605 |
|
| 606 |
-
.upload-
|
| 607 |
font-size: 13px;
|
| 608 |
font-weight: 700;
|
| 609 |
color: var(--text);
|
| 610 |
}}
|
| 611 |
|
| 612 |
-
.upload-sub {{
|
| 613 |
font-size: 12px;
|
| 614 |
color: var(--text-muted);
|
| 615 |
}}
|
| 616 |
|
| 617 |
-
/* ──
|
| 618 |
-
.preview-
|
| 619 |
display: flex;
|
| 620 |
-
flex-
|
| 621 |
-
gap:
|
| 622 |
-
padding: 10px;
|
| 623 |
}}
|
| 624 |
|
| 625 |
-
.
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
border: 1px solid var(--border);
|
| 630 |
-
overflow: hidden;
|
| 631 |
-
background: #0f0010;
|
| 632 |
-
flex-shrink: 0;
|
| 633 |
}}
|
| 634 |
|
| 635 |
-
.
|
| 636 |
-
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
|
| 640 |
}}
|
| 641 |
|
| 642 |
-
.
|
| 643 |
-
|
| 644 |
-
|
| 645 |
-
|
| 646 |
-
|
| 647 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 648 |
border: 1px solid var(--border);
|
| 649 |
-
background: rgba(26,0,18,0.88);
|
| 650 |
color: white;
|
|
|
|
|
|
|
| 651 |
cursor: pointer;
|
| 652 |
display: flex;
|
| 653 |
align-items: center;
|
| 654 |
justify-content: center;
|
| 655 |
-
|
| 656 |
-
|
| 657 |
}}
|
| 658 |
|
| 659 |
-
.thumb-
|
| 660 |
-
|
| 661 |
-
|
| 662 |
-
|
| 663 |
-
|
| 664 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 665 |
display: flex;
|
| 666 |
align-items: center;
|
| 667 |
justify-content: center;
|
| 668 |
cursor: pointer;
|
| 669 |
-
|
| 670 |
-
|
| 671 |
-
transition:
|
| 672 |
}}
|
| 673 |
|
| 674 |
-
.
|
| 675 |
border-color: var(--orange);
|
| 676 |
color: var(--orange);
|
| 677 |
}}
|
| 678 |
|
| 679 |
-
/* ──
|
| 680 |
-
.advanced-wrap {{
|
| 681 |
-
border: 1px solid var(--border-soft);
|
| 682 |
-
background: #1e0018;
|
| 683 |
-
}}
|
| 684 |
-
|
| 685 |
.advanced-toggle {{
|
| 686 |
width: 100%;
|
| 687 |
-
|
| 688 |
-
|
| 689 |
-
border
|
| 690 |
-
|
| 691 |
color: var(--text-dim);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 692 |
display: flex;
|
| 693 |
align-items: center;
|
| 694 |
justify-content: space-between;
|
| 695 |
-
|
| 696 |
-
cursor: pointer;
|
| 697 |
-
font-size: 12px;
|
| 698 |
-
font-weight: 700;
|
| 699 |
-
font-family: var(--mono);
|
| 700 |
-
letter-spacing: 0.06em;
|
| 701 |
-
text-transform: uppercase;
|
| 702 |
-
transition: background 0.15s ease;
|
| 703 |
}}
|
| 704 |
|
| 705 |
-
.advanced-toggle:hover {{
|
| 706 |
-
background: var(--surface-2);
|
| 707 |
-
}}
|
| 708 |
|
| 709 |
-
.
|
| 710 |
-
|
|
|
|
| 711 |
}}
|
| 712 |
|
|
|
|
|
|
|
| 713 |
.advanced-body {{
|
| 714 |
display: none;
|
| 715 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 716 |
}}
|
| 717 |
|
| 718 |
-
.advanced-body.open {{
|
| 719 |
-
display: block;
|
| 720 |
-
}}
|
| 721 |
|
| 722 |
-
.adv-grid {{
|
| 723 |
-
display: grid;
|
| 724 |
-
grid-template-columns: 1fr 1fr;
|
| 725 |
-
gap: 12px;
|
| 726 |
-
}}
|
| 727 |
|
| 728 |
-
.
|
| 729 |
-
display: flex;
|
| 730 |
-
flex-direction: column;
|
| 731 |
-
gap: 4px;
|
| 732 |
-
}}
|
| 733 |
|
| 734 |
-
.
|
| 735 |
display: flex;
|
| 736 |
align-items: center;
|
| 737 |
-
|
| 738 |
-
}}
|
| 739 |
-
|
| 740 |
-
.range-row input[type="range"] {{
|
| 741 |
-
flex: 1;
|
| 742 |
-
accent-color: var(--orange);
|
| 743 |
-
cursor: pointer;
|
| 744 |
-
}}
|
| 745 |
-
|
| 746 |
-
.range-val {{
|
| 747 |
-
font-family: var(--mono);
|
| 748 |
font-size: 12px;
|
| 749 |
color: var(--text-dim);
|
| 750 |
-
|
| 751 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 752 |
}}
|
| 753 |
|
| 754 |
.checkbox-row {{
|
|
@@ -757,382 +853,388 @@ async def homepage(request: Request):
|
|
| 757 |
gap: 8px;
|
| 758 |
font-size: 13px;
|
| 759 |
color: var(--text-dim);
|
| 760 |
-
margin-top: 10px;
|
| 761 |
}}
|
| 762 |
|
| 763 |
-
.checkbox-row input
|
| 764 |
-
accent-color: var(--orange);
|
| 765 |
-
width: 14px;
|
| 766 |
-
height: 14px;
|
| 767 |
-
}}
|
| 768 |
|
| 769 |
-
/* ──
|
| 770 |
-
.
|
| 771 |
-
|
| 772 |
-
|
| 773 |
-
|
| 774 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 775 |
}}
|
| 776 |
|
| 777 |
-
.btn {{
|
| 778 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 779 |
border: 1px solid var(--border);
|
| 780 |
-
|
| 781 |
-
|
| 782 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 783 |
font-size: 13px;
|
| 784 |
font-weight: 700;
|
| 785 |
-
|
| 786 |
-
letter-spacing: 0.04em;
|
| 787 |
text-transform: uppercase;
|
| 788 |
-
|
| 789 |
}}
|
| 790 |
|
| 791 |
-
.
|
| 792 |
-
|
| 793 |
-
|
|
|
|
|
|
|
| 794 |
}}
|
| 795 |
|
| 796 |
-
.
|
| 797 |
-
|
| 798 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 799 |
}}
|
| 800 |
|
| 801 |
-
.
|
| 802 |
-
|
| 803 |
-
|
| 804 |
-
|
|
|
|
|
|
|
|
|
|
| 805 |
}}
|
| 806 |
|
| 807 |
-
.
|
| 808 |
-
|
| 809 |
-
|
|
|
|
|
|
|
| 810 |
}}
|
| 811 |
|
| 812 |
-
|
| 813 |
-
.result-panel {{
|
| 814 |
display: flex;
|
| 815 |
flex-direction: column;
|
| 816 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 817 |
}}
|
| 818 |
|
| 819 |
-
/*
|
| 820 |
-
.
|
| 821 |
position: relative;
|
| 822 |
-
width: 100%;
|
| 823 |
-
aspect-ratio: 4/3;
|
| 824 |
-
background: #0f0010;
|
| 825 |
-
overflow: hidden;
|
| 826 |
user-select: none;
|
| 827 |
-
|
| 828 |
}}
|
| 829 |
|
| 830 |
-
.
|
| 831 |
-
aspect-ratio: unset;
|
| 832 |
-
}}
|
| 833 |
|
| 834 |
-
.
|
| 835 |
-
|
| 836 |
-
inset: 0;
|
| 837 |
width: 100%;
|
| 838 |
-
height:
|
| 839 |
-
object-fit: contain;
|
| 840 |
}}
|
| 841 |
|
| 842 |
-
.
|
| 843 |
-
|
| 844 |
-
|
|
|
|
|
|
|
|
|
|
| 845 |
}}
|
| 846 |
|
| 847 |
-
.
|
| 848 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 849 |
}}
|
| 850 |
|
| 851 |
-
.
|
| 852 |
position: absolute;
|
| 853 |
top: 0;
|
| 854 |
-
|
| 855 |
-
left: 50%;
|
| 856 |
width: 2px;
|
| 857 |
background: white;
|
| 858 |
-
|
| 859 |
-
|
| 860 |
-
pointer-events: none;
|
| 861 |
}}
|
| 862 |
|
| 863 |
-
.
|
|
|
|
| 864 |
position: absolute;
|
| 865 |
top: 50%;
|
| 866 |
left: 50%;
|
| 867 |
transform: translate(-50%, -50%);
|
| 868 |
-
width:
|
| 869 |
-
height:
|
|
|
|
| 870 |
background: white;
|
| 871 |
-
|
| 872 |
-
z-index: 4;
|
| 873 |
-
cursor: ew-resize;
|
| 874 |
-
display: flex;
|
| 875 |
-
align-items: center;
|
| 876 |
-
justify-content: center;
|
| 877 |
-
color: #1a0012;
|
| 878 |
-
box-shadow: 0 2px 10px rgba(0,0,0,0.4);
|
| 879 |
}}
|
| 880 |
|
| 881 |
-
.
|
| 882 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 883 |
position: absolute;
|
| 884 |
top: 12px;
|
| 885 |
-
z-index: 5;
|
| 886 |
-
font-family: var(--mono);
|
| 887 |
-
font-size: 11px;
|
| 888 |
-
font-weight: 700;
|
| 889 |
-
letter-spacing: 0.06em;
|
| 890 |
-
text-transform: uppercase;
|
| 891 |
padding: 4px 10px;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 892 |
pointer-events: none;
|
|
|
|
| 893 |
}}
|
| 894 |
|
| 895 |
-
.
|
| 896 |
left: 12px;
|
| 897 |
-
background:
|
| 898 |
color: white;
|
| 899 |
}}
|
| 900 |
|
| 901 |
-
.
|
| 902 |
right: 12px;
|
| 903 |
-
background: rgba(
|
| 904 |
color: var(--text);
|
| 905 |
border: 1px solid var(--border);
|
| 906 |
}}
|
| 907 |
|
| 908 |
-
|
|
|
|
|
|
|
|
|
|
| 909 |
display: flex;
|
| 910 |
-
flex-direction: column;
|
| 911 |
align-items: center;
|
| 912 |
-
|
| 913 |
-
|
| 914 |
-
|
| 915 |
-
text-align: center;
|
| 916 |
-
height: 100%;
|
| 917 |
-
min-height: 400px;
|
| 918 |
}}
|
| 919 |
|
| 920 |
-
.
|
| 921 |
-
|
| 922 |
-
height: 64px;
|
| 923 |
-
border: 1px solid var(--border-soft);
|
| 924 |
-
background: var(--surface-2);
|
| 925 |
-
display: flex;
|
| 926 |
align-items: center;
|
| 927 |
-
|
| 928 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 929 |
}}
|
| 930 |
|
| 931 |
-
|
|
|
|
|
|
|
| 932 |
.loader-overlay {{
|
| 933 |
position: absolute;
|
| 934 |
inset: 0;
|
|
|
|
|
|
|
|
|
|
| 935 |
display: none;
|
| 936 |
-
flex-direction: column;
|
| 937 |
align-items: center;
|
| 938 |
justify-content: center;
|
|
|
|
| 939 |
gap: 16px;
|
| 940 |
-
|
| 941 |
-
backdrop-filter: blur(8px);
|
| 942 |
-
-webkit-backdrop-filter: blur(8px);
|
| 943 |
-
z-index: 10;
|
| 944 |
}}
|
| 945 |
|
| 946 |
-
.
|
|
|
|
|
|
|
| 947 |
width: 52px;
|
| 948 |
height: 52px;
|
| 949 |
-
border-radius: 50%
|
| 950 |
-
border: 3px solid rgba(
|
| 951 |
border-top-color: var(--orange);
|
| 952 |
-
border-right-color: #ff8c66;
|
| 953 |
animation: spin 0.85s linear infinite;
|
| 954 |
}}
|
| 955 |
|
| 956 |
.loader-text {{
|
| 957 |
-
font-family: var(--mono);
|
| 958 |
font-size: 13px;
|
| 959 |
-
font-weight:
|
| 960 |
-
color:
|
| 961 |
-
|
| 962 |
-
|
| 963 |
-
|
| 964 |
-
@keyframes spin {{
|
| 965 |
-
from {{ transform: rotate(0deg); }}
|
| 966 |
-
to {{ transform: rotate(360deg); }}
|
| 967 |
-
}}
|
| 968 |
-
|
| 969 |
-
/* ── meta bar ── */
|
| 970 |
-
.meta-bar {{
|
| 971 |
-
border-top: 1px solid var(--border);
|
| 972 |
-
display: flex;
|
| 973 |
-
gap: 0;
|
| 974 |
-
}}
|
| 975 |
-
|
| 976 |
-
.meta-item {{
|
| 977 |
-
flex: 1;
|
| 978 |
-
padding: 10px 14px;
|
| 979 |
-
border-right: 1px solid var(--border);
|
| 980 |
-
}}
|
| 981 |
-
|
| 982 |
-
.meta-item:last-child {{
|
| 983 |
-
border-right: none;
|
| 984 |
-
}}
|
| 985 |
-
|
| 986 |
-
.meta-label {{
|
| 987 |
-
font-family: var(--mono);
|
| 988 |
-
font-size: 10px;
|
| 989 |
-
font-weight: 700;
|
| 990 |
-
letter-spacing: 0.08em;
|
| 991 |
-
text-transform: uppercase;
|
| 992 |
-
color: var(--text-muted);
|
| 993 |
-
margin-bottom: 3px;
|
| 994 |
-
}}
|
| 995 |
-
|
| 996 |
-
.meta-value {{
|
| 997 |
-
font-family: var(--mono);
|
| 998 |
-
font-size: 13px;
|
| 999 |
-
font-weight: 700;
|
| 1000 |
-
color: var(--text);
|
| 1001 |
-
}}
|
| 1002 |
-
|
| 1003 |
-
/* ── download bar ── */
|
| 1004 |
-
.download-bar {{
|
| 1005 |
-
border-top: 1px solid var(--border);
|
| 1006 |
-
display: grid;
|
| 1007 |
-
grid-template-columns: 1fr 1fr;
|
| 1008 |
-
gap: 0;
|
| 1009 |
-
}}
|
| 1010 |
-
|
| 1011 |
-
.dl-btn {{
|
| 1012 |
-
display: flex;
|
| 1013 |
-
align-items: center;
|
| 1014 |
-
justify-content: center;
|
| 1015 |
-
gap: 8px;
|
| 1016 |
-
height: 44px;
|
| 1017 |
-
border: none;
|
| 1018 |
-
border-right: 1px solid var(--border);
|
| 1019 |
-
background: transparent;
|
| 1020 |
-
color: var(--text-dim);
|
| 1021 |
-
font-family: var(--mono);
|
| 1022 |
-
font-size: 12px;
|
| 1023 |
-
font-weight: 700;
|
| 1024 |
-
letter-spacing: 0.04em;
|
| 1025 |
-
text-transform: uppercase;
|
| 1026 |
-
cursor: pointer;
|
| 1027 |
-
text-decoration: none;
|
| 1028 |
-
transition: background 0.15s ease, color 0.15s ease;
|
| 1029 |
-
}}
|
| 1030 |
-
|
| 1031 |
-
.dl-btn:last-child {{
|
| 1032 |
-
border-right: none;
|
| 1033 |
-
}}
|
| 1034 |
-
|
| 1035 |
-
.dl-btn:hover {{
|
| 1036 |
-
background: var(--surface-2);
|
| 1037 |
-
color: var(--text);
|
| 1038 |
-
}}
|
| 1039 |
-
|
| 1040 |
-
.dl-btn:not([href]) {{
|
| 1041 |
-
opacity: 0.35;
|
| 1042 |
-
pointer-events: none;
|
| 1043 |
-
}}
|
| 1044 |
-
|
| 1045 |
-
/* ── status pill ── */
|
| 1046 |
-
.status-pill {{
|
| 1047 |
-
font-family: var(--mono);
|
| 1048 |
-
font-size: 11px;
|
| 1049 |
-
font-weight: 700;
|
| 1050 |
-
letter-spacing: 0.04em;
|
| 1051 |
-
padding: 3px 8px;
|
| 1052 |
-
border: 1px solid var(--border-soft);
|
| 1053 |
-
color: var(--text-muted);
|
| 1054 |
-
background: var(--surface-3);
|
| 1055 |
-
transition: all 0.2s ease;
|
| 1056 |
}}
|
| 1057 |
|
| 1058 |
-
|
| 1059 |
-
background: var(--orange-soft);
|
| 1060 |
-
border-color: var(--orange-border);
|
| 1061 |
-
color: #ffb399;
|
| 1062 |
-
}}
|
| 1063 |
|
| 1064 |
-
/* ──
|
| 1065 |
-
.examples-
|
| 1066 |
-
margin-top: 24px;
|
| 1067 |
background: var(--surface);
|
| 1068 |
border: 1px solid var(--border);
|
|
|
|
|
|
|
|
|
|
| 1069 |
}}
|
| 1070 |
|
| 1071 |
.examples-header {{
|
| 1072 |
-
height:
|
|
|
|
| 1073 |
border-bottom: 1px solid var(--border);
|
| 1074 |
display: flex;
|
| 1075 |
align-items: center;
|
| 1076 |
padding: 0 16px;
|
| 1077 |
-
|
| 1078 |
-
}}
|
| 1079 |
-
|
| 1080 |
-
.examples-title {{
|
| 1081 |
-
font-family: var(--mono);
|
| 1082 |
-
font-size: 12px;
|
| 1083 |
-
font-weight: 700;
|
| 1084 |
-
letter-spacing: 0.08em;
|
| 1085 |
-
text-transform: uppercase;
|
| 1086 |
-
color: var(--text-muted);
|
| 1087 |
-
}}
|
| 1088 |
-
|
| 1089 |
-
.examples-body {{
|
| 1090 |
-
padding: 16px;
|
| 1091 |
}}
|
| 1092 |
|
| 1093 |
.examples-grid {{
|
|
|
|
| 1094 |
display: grid;
|
| 1095 |
-
grid-template-columns: repeat(
|
| 1096 |
-
gap:
|
| 1097 |
}}
|
| 1098 |
|
| 1099 |
.example-card {{
|
| 1100 |
-
background: var(--
|
| 1101 |
-
border: 1px solid var(--border
|
| 1102 |
-
|
| 1103 |
overflow: hidden;
|
| 1104 |
-
|
|
|
|
| 1105 |
}}
|
| 1106 |
|
| 1107 |
.example-card:hover {{
|
| 1108 |
border-color: var(--orange);
|
| 1109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1110 |
}}
|
| 1111 |
|
| 1112 |
-
.example-
|
| 1113 |
width: 100%;
|
| 1114 |
-
|
| 1115 |
object-fit: cover;
|
| 1116 |
display: block;
|
| 1117 |
-
|
| 1118 |
}}
|
| 1119 |
|
|
|
|
|
|
|
| 1120 |
.example-card-body {{
|
| 1121 |
-
padding: 10px;
|
| 1122 |
}}
|
| 1123 |
|
| 1124 |
-
.example-
|
| 1125 |
font-size: 12px;
|
| 1126 |
color: var(--text-dim);
|
| 1127 |
line-height: 1.5;
|
| 1128 |
-
|
|
|
|
|
|
|
|
|
|
| 1129 |
}}
|
| 1130 |
|
| 1131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1132 |
.toast-wrap {{
|
| 1133 |
position: fixed;
|
| 1134 |
-
|
| 1135 |
-
right:
|
| 1136 |
z-index: 9999;
|
| 1137 |
display: flex;
|
| 1138 |
flex-direction: column;
|
|
@@ -1140,661 +1242,603 @@ async def homepage(request: Request):
|
|
| 1140 |
}}
|
| 1141 |
|
| 1142 |
.toast {{
|
| 1143 |
-
min-width: 240px;
|
| 1144 |
-
max-width: 340px;
|
| 1145 |
-
background: #1a0012;
|
| 1146 |
-
border: 1px solid var(--border);
|
| 1147 |
-
color: var(--text);
|
| 1148 |
-
padding: 10px 12px;
|
| 1149 |
display: flex;
|
| 1150 |
align-items: flex-start;
|
| 1151 |
-
justify-content: space-between;
|
| 1152 |
gap: 10px;
|
| 1153 |
-
|
| 1154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1155 |
}}
|
| 1156 |
|
| 1157 |
-
.toast
|
| 1158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1159 |
background: transparent;
|
|
|
|
| 1160 |
color: var(--text-muted);
|
| 1161 |
font-size: 16px;
|
| 1162 |
cursor: pointer;
|
| 1163 |
-
padding: 0;
|
| 1164 |
line-height: 1;
|
| 1165 |
-
|
| 1166 |
-
}}
|
| 1167 |
-
|
| 1168 |
-
.toast button:hover {{
|
| 1169 |
-
color: var(--text);
|
| 1170 |
}}
|
| 1171 |
|
| 1172 |
-
|
| 1173 |
-
|
| 1174 |
-
|
| 1175 |
-
grid-template-columns: 360px 1fr;
|
| 1176 |
-
}}
|
| 1177 |
}}
|
| 1178 |
|
| 1179 |
-
|
| 1180 |
-
|
| 1181 |
-
|
| 1182 |
-
}}
|
| 1183 |
-
.examples-grid {{
|
| 1184 |
-
grid-template-columns: repeat(2, 1fr);
|
| 1185 |
-
}}
|
| 1186 |
}}
|
| 1187 |
|
| 1188 |
-
@media (max-width:
|
| 1189 |
-
.
|
| 1190 |
-
|
| 1191 |
-
}}
|
| 1192 |
-
.
|
| 1193 |
-
font-size: 28px;
|
| 1194 |
-
}}
|
| 1195 |
-
.examples-grid {{
|
| 1196 |
-
grid-template-columns: 1fr;
|
| 1197 |
-
}}
|
| 1198 |
-
.adv-grid {{
|
| 1199 |
-
grid-template-columns: 1fr;
|
| 1200 |
-
}}
|
| 1201 |
-
.actions {{
|
| 1202 |
-
grid-template-columns: 1fr;
|
| 1203 |
-
}}
|
| 1204 |
}}
|
| 1205 |
</style>
|
| 1206 |
</head>
|
| 1207 |
<body>
|
| 1208 |
|
| 1209 |
-
<div class="toast-wrap" id="toastWrap"></div>
|
| 1210 |
|
| 1211 |
-
<!--
|
| 1212 |
-
<div class="topbar">
|
| 1213 |
-
|
| 1214 |
-
|
| 1215 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1216 |
</div>
|
| 1217 |
-
|
| 1218 |
-
<div class="
|
| 1219 |
-
|
| 1220 |
-
|
| 1221 |
-
<div class="
|
| 1222 |
-
|
| 1223 |
-
|
| 1224 |
-
|
| 1225 |
-
|
| 1226 |
-
|
| 1227 |
-
|
| 1228 |
-
|
| 1229 |
-
|
| 1230 |
-
|
| 1231 |
-
|
| 1232 |
-
|
| 1233 |
-
|
| 1234 |
-
|
| 1235 |
-
<
|
| 1236 |
-
<div class="tag">vae comparison</div>
|
| 1237 |
</div>
|
| 1238 |
-
</section>
|
| 1239 |
|
| 1240 |
-
|
| 1241 |
-
|
| 1242 |
|
| 1243 |
-
|
| 1244 |
-
|
| 1245 |
-
|
| 1246 |
-
|
| 1247 |
-
|
| 1248 |
-
|
| 1249 |
-
|
| 1250 |
-
|
|
|
|
|
|
|
| 1251 |
|
| 1252 |
-
<!--
|
| 1253 |
-
<div class="
|
| 1254 |
-
<div class="label">Images (optional)</div>
|
| 1255 |
<div class="upload-zone" id="uploadZone">
|
| 1256 |
<input id="fileInput" type="file" accept="image/*" multiple />
|
| 1257 |
<button class="upload-placeholder" id="uploadPlaceholder" type="button">
|
| 1258 |
<div class="upload-icon-wrap">
|
| 1259 |
-
<svg
|
| 1260 |
-
<path d="
|
| 1261 |
-
<
|
| 1262 |
-
<
|
| 1263 |
</svg>
|
| 1264 |
</div>
|
| 1265 |
-
<div>
|
| 1266 |
-
|
| 1267 |
-
<div class="upload-sub">PNG, JPG, WEBP · multiple files supported</div>
|
| 1268 |
-
</div>
|
| 1269 |
</button>
|
| 1270 |
-
<div class="preview-strip" id="previewStrip" style="display:none;"></div>
|
| 1271 |
</div>
|
| 1272 |
-
<div
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1273 |
</div>
|
| 1274 |
|
| 1275 |
-
<!--
|
| 1276 |
-
<div class="
|
| 1277 |
-
<label class="label" for="prompt">Prompt</label>
|
| 1278 |
-
<textarea id="prompt"
|
| 1279 |
-
placeholder="e.g. Change the weather to stormy..."></textarea>
|
| 1280 |
</div>
|
| 1281 |
|
| 1282 |
-
<!--
|
| 1283 |
-
<div class="
|
| 1284 |
-
<button class="advanced-toggle" id="
|
| 1285 |
<span>Advanced Settings</span>
|
| 1286 |
-
<span id="
|
| 1287 |
</button>
|
| 1288 |
-
<div class="advanced-body" id="
|
| 1289 |
<div class="adv-grid">
|
| 1290 |
-
|
| 1291 |
-
|
| 1292 |
-
|
| 1293 |
-
|
| 1294 |
-
<input id="width" type="range" min="256" max="{MAX_IMAGE_SIZE}" step="8" value="1024" />
|
| 1295 |
-
<span class="range-val" id="widthVal">1024</span>
|
| 1296 |
</div>
|
|
|
|
|
|
|
| 1297 |
</div>
|
| 1298 |
-
|
| 1299 |
-
|
| 1300 |
-
|
| 1301 |
-
|
| 1302 |
-
<input id="height" type="range" min="256" max="{MAX_IMAGE_SIZE}" step="8" value="1024" />
|
| 1303 |
-
<span class="range-val" id="heightVal">1024</span>
|
| 1304 |
</div>
|
|
|
|
|
|
|
| 1305 |
</div>
|
| 1306 |
-
|
| 1307 |
-
|
| 1308 |
-
|
| 1309 |
-
|
| 1310 |
-
<input id="steps" type="range" min="1" max="20" step="1" value="4" />
|
| 1311 |
-
<span class="range-val" id="stepsVal">4</span>
|
| 1312 |
</div>
|
|
|
|
|
|
|
| 1313 |
</div>
|
| 1314 |
-
|
| 1315 |
-
|
| 1316 |
-
|
| 1317 |
-
|
| 1318 |
-
<input id="guidance" type="range" min="0" max="10" step="0.1" value="1.0" />
|
| 1319 |
-
<span class="range-val" id="guidanceVal">1.0</span>
|
| 1320 |
</div>
|
|
|
|
|
|
|
| 1321 |
</div>
|
| 1322 |
-
|
| 1323 |
-
|
| 1324 |
-
|
| 1325 |
-
|
| 1326 |
-
<input id="seed" type="range" min="0" max="{MAX_SEED}" step="1" value="0" />
|
| 1327 |
-
<span class="range-val" id="seedVal">0</span>
|
| 1328 |
</div>
|
|
|
|
|
|
|
| 1329 |
</div>
|
| 1330 |
-
|
| 1331 |
</div>
|
| 1332 |
<div class="checkbox-row">
|
| 1333 |
-
<input
|
| 1334 |
<label for="randomizeSeed">Randomize seed on each run</label>
|
| 1335 |
</div>
|
| 1336 |
</div>
|
| 1337 |
</div>
|
| 1338 |
|
| 1339 |
-
<!--
|
| 1340 |
-
<
|
| 1341 |
-
<
|
| 1342 |
-
|
| 1343 |
-
|
|
|
|
|
|
|
| 1344 |
|
| 1345 |
</div>
|
| 1346 |
</div>
|
| 1347 |
-
</div>
|
| 1348 |
|
| 1349 |
-
|
| 1350 |
-
|
| 1351 |
-
|
| 1352 |
-
|
| 1353 |
-
|
| 1354 |
-
|
|
|
|
|
|
|
|
|
|
| 1355 |
|
| 1356 |
-
|
| 1357 |
-
|
| 1358 |
|
| 1359 |
-
|
| 1360 |
-
|
| 1361 |
-
|
| 1362 |
-
|
| 1363 |
-
|
| 1364 |
-
|
| 1365 |
-
<
|
| 1366 |
-
</
|
| 1367 |
-
|
| 1368 |
-
|
| 1369 |
-
<div style="font-size:15px; font-weight:700; color:var(--text); margin-bottom:4px;">No output yet</div>
|
| 1370 |
-
<div style="font-size:13px; color:var(--text-muted);">Run a comparison to see results here</div>
|
| 1371 |
</div>
|
| 1372 |
-
</div>
|
| 1373 |
|
| 1374 |
-
|
| 1375 |
-
|
| 1376 |
-
|
| 1377 |
-
|
| 1378 |
-
|
| 1379 |
-
<!-- labels -->
|
| 1380 |
-
<div class="slider-label-left" id="lblLeft" style="display:none;">Standard</div>
|
| 1381 |
-
<div class="slider-label-right" id="lblRight" style="display:none;">Small Decoder</div>
|
| 1382 |
-
|
| 1383 |
-
<!-- divider + handle -->
|
| 1384 |
-
<div class="slider-divider" id="sliderDivider" style="display:none;"></div>
|
| 1385 |
-
<div class="slider-handle" id="sliderHandle" style="display:none;">
|
| 1386 |
-
<svg viewBox="0 0 20 20" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2">
|
| 1387 |
-
<path d="M7 5l-4 5 4 5"/>
|
| 1388 |
-
<path d="M13 5l4 5-4 5"/>
|
| 1389 |
-
</svg>
|
| 1390 |
-
</div>
|
| 1391 |
|
| 1392 |
-
|
| 1393 |
-
|
| 1394 |
-
|
| 1395 |
-
|
| 1396 |
-
|
| 1397 |
|
| 1398 |
-
|
|
|
|
|
|
|
| 1399 |
|
| 1400 |
-
|
| 1401 |
-
|
| 1402 |
-
|
| 1403 |
-
|
| 1404 |
-
<
|
| 1405 |
-
</div>
|
| 1406 |
-
<div class="meta-item">
|
| 1407 |
-
<div class="meta-label">Device</div>
|
| 1408 |
-
<div class="meta-value" id="metaDevice">{DEVICE_LABEL}</div>
|
| 1409 |
-
</div>
|
| 1410 |
-
<div class="meta-item">
|
| 1411 |
-
<div class="meta-label">Resolution</div>
|
| 1412 |
-
<div class="meta-value" id="metaRes">—</div>
|
| 1413 |
</div>
|
| 1414 |
-
</div>
|
| 1415 |
|
| 1416 |
-
|
| 1417 |
-
|
| 1418 |
-
|
| 1419 |
-
|
| 1420 |
-
|
| 1421 |
-
|
| 1422 |
-
|
| 1423 |
-
|
| 1424 |
-
|
| 1425 |
-
|
| 1426 |
-
|
| 1427 |
-
|
| 1428 |
-
|
| 1429 |
-
|
|
|
|
|
|
|
| 1430 |
</div>
|
| 1431 |
-
|
| 1432 |
</div>
|
| 1433 |
-
</div>
|
| 1434 |
|
| 1435 |
-
|
| 1436 |
-
|
| 1437 |
-
|
| 1438 |
-
|
| 1439 |
-
|
| 1440 |
-
|
|
|
|
|
|
|
|
|
|
| 1441 |
<div class="examples-grid" id="examplesGrid"></div>
|
| 1442 |
</div>
|
| 1443 |
-
|
| 1444 |
-
|
| 1445 |
-
|
| 1446 |
-
|
| 1447 |
-
|
| 1448 |
-
|
| 1449 |
-
|
| 1450 |
-
|
| 1451 |
-
|
| 1452 |
-
|
| 1453 |
-
|
| 1454 |
-
|
| 1455 |
-
|
| 1456 |
-
|
| 1457 |
-
|
| 1458 |
-
|
| 1459 |
-
|
| 1460 |
-
|
| 1461 |
-
|
| 1462 |
-
|
| 1463 |
-
|
| 1464 |
-
|
| 1465 |
-
|
| 1466 |
-
|
| 1467 |
-
|
| 1468 |
-
|
| 1469 |
-
|
| 1470 |
-
|
| 1471 |
-
|
| 1472 |
-
|
| 1473 |
-
|
| 1474 |
-
|
| 1475 |
-
|
| 1476 |
-
|
| 1477 |
-
|
| 1478 |
-
|
| 1479 |
-
|
| 1480 |
-
|
| 1481 |
-
|
| 1482 |
-
|
| 1483 |
-
|
| 1484 |
-
|
| 1485 |
-
|
| 1486 |
-
|
| 1487 |
-
|
| 1488 |
-
|
| 1489 |
-
|
| 1490 |
-
|
| 1491 |
-
|
| 1492 |
-
|
| 1493 |
-
|
| 1494 |
-
|
| 1495 |
-
|
| 1496 |
-
|
| 1497 |
-
|
| 1498 |
-
|
| 1499 |
-
|
| 1500 |
-
|
| 1501 |
-
|
| 1502 |
-
|
| 1503 |
-
|
| 1504 |
-
|
| 1505 |
-
|
| 1506 |
-
|
| 1507 |
-
|
| 1508 |
-
|
| 1509 |
-
|
| 1510 |
-
|
| 1511 |
-
|
| 1512 |
-
|
| 1513 |
-
|
| 1514 |
-
|
| 1515 |
-
|
| 1516 |
-
|
| 1517 |
-
|
| 1518 |
-
|
| 1519 |
-
|
| 1520 |
-
|
| 1521 |
-
|
| 1522 |
-
|
| 1523 |
-
|
| 1524 |
-
|
| 1525 |
-
input.addEventListener("input", () => {{
|
| 1526 |
-
display.textContent = isFloat
|
| 1527 |
-
? parseFloat(input.value).toFixed(1)
|
| 1528 |
-
: input.value;
|
| 1529 |
}});
|
| 1530 |
-
|
| 1531 |
-
|
| 1532 |
-
|
| 1533 |
-
|
| 1534 |
-
|
| 1535 |
-
|
| 1536 |
-
|
| 1537 |
-
/* ── advanced panel ── */
|
| 1538 |
-
advToggle.addEventListener("click", () => {{
|
| 1539 |
-
state.advOpen = !state.advOpen;
|
| 1540 |
-
advBody.classList.toggle("open", state.advOpen);
|
| 1541 |
-
advToggle.classList.toggle("open", state.advOpen);
|
| 1542 |
-
advIcon.textContent = state.advOpen ? "−" : "+";
|
| 1543 |
-
}});
|
| 1544 |
-
|
| 1545 |
-
/* ── upload ── */
|
| 1546 |
-
function createThumb(file, index) {{
|
| 1547 |
-
const wrap = document.createElement("div");
|
| 1548 |
-
wrap.className = "thumb";
|
| 1549 |
-
const img = document.createElement("img");
|
| 1550 |
-
img.src = URL.createObjectURL(file);
|
| 1551 |
-
img.alt = file.name;
|
| 1552 |
-
const rm = document.createElement("button");
|
| 1553 |
-
rm.type = "button";
|
| 1554 |
-
rm.className = "thumb-remove";
|
| 1555 |
-
rm.innerHTML = "×";
|
| 1556 |
-
rm.title = "Remove";
|
| 1557 |
-
rm.addEventListener("click", (e) => {{
|
| 1558 |
-
e.stopPropagation();
|
| 1559 |
-
state.files.splice(index, 1);
|
| 1560 |
renderPreviews();
|
| 1561 |
-
}}
|
| 1562 |
-
|
| 1563 |
-
|
| 1564 |
-
|
| 1565 |
-
|
| 1566 |
-
|
| 1567 |
-
|
| 1568 |
-
|
| 1569 |
-
|
| 1570 |
-
|
| 1571 |
-
|
| 1572 |
-
|
| 1573 |
-
|
| 1574 |
-
|
| 1575 |
-
|
| 1576 |
-
|
| 1577 |
-
|
| 1578 |
-
|
| 1579 |
-
|
| 1580 |
-
|
| 1581 |
-
|
| 1582 |
-
|
| 1583 |
-
|
| 1584 |
-
|
| 1585 |
-
|
| 1586 |
-
|
| 1587 |
-
|
| 1588 |
-
|
| 1589 |
-
|
| 1590 |
-
|
| 1591 |
-
|
| 1592 |
-
|
| 1593 |
-
|
| 1594 |
-
|
| 1595 |
-
uploadPlaceholder.addEventListener("click", () => fileInput.click());
|
| 1596 |
-
uploadZone.addEventListener("click", (e) => {{ if (e.target === uploadZone) fileInput.click(); }});
|
| 1597 |
-
fileInput.addEventListener("change", (e) => {{ addFiles(e.target.files); fileInput.value = ""; }});
|
| 1598 |
-
uploadZone.addEventListener("dragover", (e) => {{ e.preventDefault(); uploadZone.classList.add("dragover"); }});
|
| 1599 |
-
uploadZone.addEventListener("dragleave", () => uploadZone.classList.remove("dragover"));
|
| 1600 |
-
uploadZone.addEventListener("drop", (e) => {{
|
| 1601 |
-
e.preventDefault();
|
| 1602 |
-
uploadZone.classList.remove("dragover");
|
| 1603 |
-
if (e.dataTransfer.files?.length) addFiles(e.dataTransfer.files);
|
| 1604 |
-
}});
|
| 1605 |
-
|
| 1606 |
-
/* ── image comparison slider ── */
|
| 1607 |
-
function setSliderPct(pct) {{
|
| 1608 |
-
state.sliderPct = Math.max(2, Math.min(98, pct));
|
| 1609 |
-
imgLeft.style.clipPath = `inset(0 ${{100 - state.sliderPct}}% 0 0)`;
|
| 1610 |
-
sliderDivider.style.left = state.sliderPct + "%";
|
| 1611 |
-
sliderHandle.style.left = state.sliderPct + "%";
|
| 1612 |
-
}}
|
| 1613 |
-
|
| 1614 |
-
function pctFromEvent(e) {{
|
| 1615 |
-
const rect = sliderWrap.getBoundingClientRect();
|
| 1616 |
-
const x = (e.touches ? e.touches[0].clientX : e.clientX) - rect.left;
|
| 1617 |
-
return (x / rect.width) * 100;
|
| 1618 |
-
}}
|
| 1619 |
-
|
| 1620 |
-
sliderHandle.addEventListener("mousedown", () => state.dragging = true);
|
| 1621 |
-
sliderHandle.addEventListener("touchstart", () => state.dragging = true, {{passive: true}});
|
| 1622 |
-
window.addEventListener("mouseup", () => state.dragging = false);
|
| 1623 |
-
window.addEventListener("touchend", () => state.dragging = false);
|
| 1624 |
-
window.addEventListener("mousemove", (e) => {{ if (state.dragging) setSliderPct(pctFromEvent(e)); }});
|
| 1625 |
-
window.addEventListener("touchmove", (e) => {{ if (state.dragging) setSliderPct(pctFromEvent(e)); }}, {{passive: true}});
|
| 1626 |
-
sliderWrap.addEventListener("click", (e) => {{
|
| 1627 |
-
if (!state.hasResult) return;
|
| 1628 |
-
if (e.target !== sliderHandle) setSliderPct(pctFromEvent(e));
|
| 1629 |
-
}});
|
| 1630 |
-
|
| 1631 |
-
/* ── loading state ── */
|
| 1632 |
-
function setLoading(loading) {{
|
| 1633 |
-
loaderOverlay.style.display = loading ? "flex" : "none";
|
| 1634 |
-
runBtn.disabled = loading;
|
| 1635 |
-
clearBtn.disabled = loading;
|
| 1636 |
-
runBtn.style.opacity = loading ? "0.65" : "1";
|
| 1637 |
-
clearBtn.style.opacity = loading ? "0.65" : "1";
|
| 1638 |
-
|
| 1639 |
-
statusPill.textContent = loading ? "Running" : "Idle";
|
| 1640 |
-
statusPill.classList.toggle("running", loading);
|
| 1641 |
-
resultStatus.textContent = loading ? "Processing" : (state.hasResult ? "Done" : "Waiting");
|
| 1642 |
-
resultStatus.classList.toggle("running", loading);
|
| 1643 |
-
}}
|
| 1644 |
-
|
| 1645 |
-
/* ── show result images ── */
|
| 1646 |
-
function showResults(stdUrl, smallUrl, seed, device, w, h) {{
|
| 1647 |
-
state.hasResult = true;
|
| 1648 |
-
|
| 1649 |
-
imgLeft.src = stdUrl + "?t=" + Date.now();
|
| 1650 |
-
imgRight.src = smallUrl + "?t=" + Date.now();
|
| 1651 |
-
|
| 1652 |
-
imgLeft.style.display = "block";
|
| 1653 |
-
imgRight.style.display = "block";
|
| 1654 |
-
sliderEmpty.style.display = "none";
|
| 1655 |
-
lblLeft.style.display = "block";
|
| 1656 |
-
lblRight.style.display = "block";
|
| 1657 |
-
sliderDivider.style.display = "block";
|
| 1658 |
-
sliderHandle.style.display = "flex";
|
| 1659 |
-
|
| 1660 |
-
setSliderPct(50);
|
| 1661 |
-
|
| 1662 |
-
metaSeed.textContent = String(seed);
|
| 1663 |
-
metaDevice.textContent = (device || "{DEVICE_LABEL}").toLowerCase();
|
| 1664 |
-
metaRes.textContent = w && h ? `${{w}} × ${{h}}` : "—";
|
| 1665 |
-
|
| 1666 |
-
dlStandard.href = stdUrl;
|
| 1667 |
-
dlStandard.download = "standard_vae.png";
|
| 1668 |
-
dlSmall.href = smallUrl;
|
| 1669 |
-
dlSmall.download = "small_decoder.png";
|
| 1670 |
-
}}
|
| 1671 |
-
|
| 1672 |
-
/* ── clear ── */
|
| 1673 |
-
function clearAll() {{
|
| 1674 |
-
state.files = [];
|
| 1675 |
-
state.hasResult = false;
|
| 1676 |
-
renderPreviews();
|
| 1677 |
-
promptEl.value = "";
|
| 1678 |
-
widthEl.value = "1024"; widthValEl.textContent = "1024";
|
| 1679 |
-
heightEl.value = "1024"; heightValEl.textContent = "1024";
|
| 1680 |
-
stepsEl.value = "4"; stepsValEl.textContent = "4";
|
| 1681 |
-
guidanceEl.value = "1.0"; guidanceValEl.textContent = "1.0";
|
| 1682 |
-
seedEl.value = "0"; seedValEl.textContent = "0";
|
| 1683 |
-
randomizeSeedEl.checked = true;
|
| 1684 |
-
|
| 1685 |
-
imgLeft.style.display = "none";
|
| 1686 |
-
imgRight.style.display = "none";
|
| 1687 |
-
imgLeft.removeAttribute("src");
|
| 1688 |
-
imgRight.removeAttribute("src");
|
| 1689 |
-
sliderEmpty.style.display = "flex";
|
| 1690 |
-
lblLeft.style.display = "none";
|
| 1691 |
-
lblRight.style.display = "none";
|
| 1692 |
-
sliderDivider.style.display = "none";
|
| 1693 |
-
sliderHandle.style.display = "none";
|
| 1694 |
-
|
| 1695 |
-
metaSeed.textContent = "—";
|
| 1696 |
-
metaDevice.textContent = "{DEVICE_LABEL}";
|
| 1697 |
-
metaRes.textContent = "—";
|
| 1698 |
-
dlStandard.removeAttribute("href");
|
| 1699 |
-
dlSmall.removeAttribute("href");
|
| 1700 |
-
|
| 1701 |
-
setLoading(false);
|
| 1702 |
-
}}
|
| 1703 |
-
|
| 1704 |
-
clearBtn.addEventListener("click", clearAll);
|
| 1705 |
-
|
| 1706 |
-
/* ── submit ── */
|
| 1707 |
-
async function submitCompare() {{
|
| 1708 |
-
const prompt = promptEl.value.trim();
|
| 1709 |
-
if (!prompt) {{ showToast("Please enter a prompt."); return; }}
|
| 1710 |
-
|
| 1711 |
-
const formData = new FormData();
|
| 1712 |
-
formData.append("prompt", prompt);
|
| 1713 |
-
formData.append("seed", seedEl.value || "0");
|
| 1714 |
-
formData.append("randomize_seed", String(randomizeSeedEl.checked));
|
| 1715 |
-
formData.append("width", widthEl.value || "1024");
|
| 1716 |
-
formData.append("height", heightEl.value || "1024");
|
| 1717 |
-
formData.append("steps", stepsEl.value || "4");
|
| 1718 |
-
formData.append("guidance_scale", guidanceEl.value || "1.0");
|
| 1719 |
-
state.files.forEach(f => formData.append("images", f));
|
| 1720 |
-
|
| 1721 |
-
setLoading(true);
|
| 1722 |
-
try {{
|
| 1723 |
-
const res = await fetch("/api/compare", {{ method: "POST", body: formData }});
|
| 1724 |
-
const data = await res.json();
|
| 1725 |
-
if (!res.ok || !data.success) throw new Error(data.error || "Processing failed.");
|
| 1726 |
-
|
| 1727 |
-
showResults(
|
| 1728 |
-
data.standard.image_url,
|
| 1729 |
-
data.small.image_url,
|
| 1730 |
-
data.seed,
|
| 1731 |
-
data.device,
|
| 1732 |
-
parseInt(widthEl.value),
|
| 1733 |
-
parseInt(heightEl.value),
|
| 1734 |
-
);
|
| 1735 |
-
}} catch (err) {{
|
| 1736 |
-
showToast(err.message || "An unexpected error occurred.");
|
| 1737 |
-
}} finally {{
|
| 1738 |
-
setLoading(false);
|
| 1739 |
-
}}
|
| 1740 |
-
}}
|
| 1741 |
-
|
| 1742 |
-
runBtn.addEventListener("click", submitCompare);
|
| 1743 |
-
promptEl.addEventListener("keydown", (e) => {{
|
| 1744 |
-
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) submitCompare();
|
| 1745 |
-
}});
|
| 1746 |
-
|
| 1747 |
-
/* ── examples ── */
|
| 1748 |
-
async function fileFromUrl(url, filename) {{
|
| 1749 |
-
const res = await fetch(url);
|
| 1750 |
-
if (!res.ok) throw new Error("Failed to fetch example image.");
|
| 1751 |
-
const blob = await res.blob();
|
| 1752 |
-
return new File([blob], filename, {{ type: blob.type || "image/jpeg" }});
|
| 1753 |
-
}}
|
| 1754 |
-
|
| 1755 |
-
function renderExamples() {{
|
| 1756 |
-
examplesGrid.innerHTML = "";
|
| 1757 |
-
examples.forEach(item => {{
|
| 1758 |
-
const card = document.createElement("div");
|
| 1759 |
-
card.className = "example-card";
|
| 1760 |
-
|
| 1761 |
-
const img = document.createElement("img");
|
| 1762 |
-
img.src = item.url;
|
| 1763 |
-
img.alt = item.file;
|
| 1764 |
-
img.loading = "lazy";
|
| 1765 |
-
|
| 1766 |
-
const body = document.createElement("div");
|
| 1767 |
-
body.className = "example-card-body";
|
| 1768 |
-
const p = document.createElement("p");
|
| 1769 |
-
p.textContent = item.prompt;
|
| 1770 |
-
|
| 1771 |
-
body.appendChild(p);
|
| 1772 |
-
card.appendChild(img);
|
| 1773 |
-
card.appendChild(body);
|
| 1774 |
-
|
| 1775 |
-
card.addEventListener("click", async () => {{
|
| 1776 |
-
try {{
|
| 1777 |
-
const f = await fileFromUrl(item.url, item.file);
|
| 1778 |
-
state.files = [f];
|
| 1779 |
renderPreviews();
|
| 1780 |
-
|
| 1781 |
-
|
| 1782 |
-
|
| 1783 |
-
|
| 1784 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1785 |
}});
|
| 1786 |
|
| 1787 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1788 |
}});
|
| 1789 |
-
}}
|
| 1790 |
|
| 1791 |
-
|
| 1792 |
-
|
| 1793 |
-
|
| 1794 |
-
|
| 1795 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1796 |
</body>
|
| 1797 |
</html>"""
|
| 1798 |
|
| 1799 |
|
| 1800 |
-
app.launch()
|
|
|
|
| 1 |
+
|
| 2 |
import os
|
| 3 |
import gc
|
| 4 |
import io
|
|
|
|
| 22 |
|
| 23 |
from diffusers import Flux2KleinPipeline, AutoencoderKLFlux2
|
| 24 |
|
| 25 |
+
app = Server()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
BASE_DIR = Path(__file__).resolve().parent
|
| 28 |
STATIC_DIR = BASE_DIR / "static"
|
|
|
|
| 32 |
STATIC_DIR.mkdir(exist_ok=True)
|
| 33 |
OUTPUT_DIR.mkdir(exist_ok=True)
|
| 34 |
|
| 35 |
+
MAX_SEED = np.iinfo(np.int32).max
|
| 36 |
+
MAX_IMAGE_SIZE = 1024
|
| 37 |
+
|
| 38 |
+
dtype = torch.bfloat16
|
| 39 |
+
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
| 40 |
+
|
| 41 |
if torch.cuda.is_available():
|
| 42 |
DEVICE_LABEL = torch.cuda.get_device_name(torch.cuda.current_device()).lower()
|
| 43 |
else:
|
| 44 |
+
DEVICE_LABEL = DEVICE
|
| 45 |
|
| 46 |
print("Loading 4B Distilled model (Standard VAE)...")
|
| 47 |
pipe_standard = Flux2KleinPipeline.from_pretrained(
|
|
|
|
| 68 |
pipe_lock_small = threading.Lock()
|
| 69 |
|
| 70 |
|
| 71 |
+
def image_to_base64(img: Image.Image) -> str:
|
| 72 |
+
buf = io.BytesIO()
|
| 73 |
+
img.save(buf, format="PNG")
|
| 74 |
+
return base64.b64encode(buf.getvalue()).decode("utf-8")
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def save_image(img: Image.Image, prefix: str = "output") -> str:
|
| 78 |
+
filename = f"{prefix}_{uuid.uuid4().hex}.png"
|
| 79 |
+
path = OUTPUT_DIR / filename
|
| 80 |
+
img.save(path, format="PNG")
|
| 81 |
+
return filename
|
| 82 |
+
|
| 83 |
+
|
| 84 |
def calc_dimensions(pil_img: Image.Image):
|
| 85 |
iw, ih = pil_img.size
|
| 86 |
aspect = iw / ih
|
|
|
|
| 95 |
return new_width, new_height
|
| 96 |
|
| 97 |
|
| 98 |
+
def parse_and_resize_images(image_paths: list, width: int, height: int):
|
|
|
|
|
|
|
| 99 |
raw_list = []
|
| 100 |
+
for path in image_paths:
|
| 101 |
+
try:
|
| 102 |
+
img = Image.open(path).convert("RGB")
|
| 103 |
+
raw_list.append(img)
|
| 104 |
+
except Exception as e:
|
| 105 |
+
print(f"Skipping invalid image: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
if not raw_list:
|
| 107 |
return None
|
| 108 |
return [img.resize((width, height), Image.LANCZOS) for img in raw_list]
|
|
|
|
| 115 |
return result
|
| 116 |
|
| 117 |
|
| 118 |
+
def get_example_items():
|
| 119 |
+
example_prompts = {
|
| 120 |
+
"1.jpg": "Change the weather to stormy.",
|
| 121 |
+
"2.jpg": "Transform the scene into a snowy winter day while preserving the original subject identity, framing, and composition.",
|
| 122 |
+
"3.jpg": "Relight the image with soft golden sunset lighting while keeping all structures and subject details consistent.",
|
| 123 |
+
"4.jpg": "Make the texture high-resolution.",
|
| 124 |
+
}
|
| 125 |
+
items = []
|
| 126 |
+
if EXAMPLES_DIR.exists():
|
| 127 |
+
for name in sorted(os.listdir(EXAMPLES_DIR)):
|
| 128 |
+
if name.lower().endswith((".png", ".jpg", ".jpeg", ".webp")):
|
| 129 |
+
items.append({
|
| 130 |
+
"file": name,
|
| 131 |
+
"url": f"/example-file/{name}",
|
| 132 |
+
"prompt": example_prompts.get(name, "Edit this image while preserving composition."),
|
| 133 |
+
})
|
| 134 |
+
return items
|
| 135 |
|
| 136 |
|
| 137 |
+
@app.get("/example-file/{filename}")
|
| 138 |
+
async def example_file(filename: str):
|
| 139 |
+
path = EXAMPLES_DIR / filename
|
| 140 |
+
if not path.exists():
|
| 141 |
+
return JSONResponse({"error": "Example not found"}, status_code=404)
|
| 142 |
+
return FileResponse(path)
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
@app.get("/download/{filename}")
|
| 146 |
+
async def download_file(filename: str):
|
| 147 |
path = OUTPUT_DIR / filename
|
| 148 |
+
if not path.exists():
|
| 149 |
+
return JSONResponse({"error": "File not found"}, status_code=404)
|
| 150 |
+
return FileResponse(path, filename=filename, media_type="image/png")
|
| 151 |
|
| 152 |
|
| 153 |
@spaces.GPU(duration=120)
|
| 154 |
+
def run_inference(image_paths, prompt, seed, randomize_seed, width, height, steps, guidance_scale):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
gc.collect()
|
| 156 |
if torch.cuda.is_available():
|
| 157 |
torch.cuda.empty_cache()
|
| 158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
if randomize_seed:
|
| 160 |
seed = random.randint(0, MAX_SEED)
|
| 161 |
|
| 162 |
image_list = None
|
| 163 |
if image_paths:
|
| 164 |
+
try:
|
| 165 |
+
first_pil = Image.open(image_paths[0]).convert("RGB")
|
| 166 |
+
width, height = calc_dimensions(first_pil)
|
| 167 |
+
except Exception:
|
| 168 |
+
pass
|
| 169 |
+
image_list = parse_and_resize_images(image_paths, width, height)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
|
| 171 |
width = max(256, min(MAX_IMAGE_SIZE, round(int(width) / 8) * 8))
|
| 172 |
height = max(256, min(MAX_IMAGE_SIZE, round(int(height) / 8) * 8))
|
|
|
|
| 175 |
prompt=prompt,
|
| 176 |
height=height,
|
| 177 |
width=width,
|
| 178 |
+
num_inference_steps=steps,
|
| 179 |
guidance_scale=guidance_scale,
|
| 180 |
)
|
| 181 |
if image_list is not None:
|
|
|
|
| 196 |
return out_standard, out_small, seed
|
| 197 |
|
| 198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
@app.post("/api/compare")
|
| 200 |
async def compare_images(
|
| 201 |
prompt: str = Form(...),
|
|
|
|
| 221 |
temp_paths.append(str(temp_path))
|
| 222 |
image_paths.append(str(temp_path))
|
| 223 |
|
| 224 |
+
out_standard, out_small, used_seed = run_inference(
|
| 225 |
+
image_paths=image_paths,
|
| 226 |
prompt=prompt,
|
| 227 |
+
seed=int(seed),
|
| 228 |
+
randomize_seed=randomize_seed.lower() == "true",
|
| 229 |
+
width=int(width),
|
| 230 |
+
height=int(height),
|
| 231 |
+
steps=int(steps),
|
| 232 |
+
guidance_scale=float(guidance_scale),
|
|
|
|
| 233 |
)
|
| 234 |
|
| 235 |
std_filename = save_image(out_standard, prefix="standard")
|
|
|
|
| 272 |
<head>
|
| 273 |
<meta charset="UTF-8" />
|
| 274 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 275 |
+
<title>FLUX.2 Decoder Comparator</title>
|
| 276 |
<style>
|
| 277 |
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;500;700&family=Ubuntu+Mono:wght@400;700&display=swap');
|
| 278 |
|
| 279 |
:root {{
|
| 280 |
+
--bg: #2c2c2c;
|
| 281 |
+
--bg-2: #3c3c3c;
|
| 282 |
+
--bg-3: #1e1e1e;
|
| 283 |
+
--surface: #3c3c3c;
|
| 284 |
+
--surface-2: #454545;
|
| 285 |
+
--surface-3: #4e4e4e;
|
| 286 |
+
--border: #555555;
|
| 287 |
+
--border-focus: #e95420;
|
| 288 |
+
--text: #eeeeee;
|
| 289 |
+
--text-dim: #aaaaaa;
|
| 290 |
+
--text-muted: #888888;
|
| 291 |
--orange: #e95420;
|
| 292 |
+
--orange-hover: #c7461a;
|
| 293 |
+
--orange-light: #f47045;
|
| 294 |
--orange-soft: rgba(233,84,32,0.15);
|
| 295 |
--orange-border: rgba(233,84,32,0.4);
|
|
|
|
|
|
|
| 296 |
--green: #4caf50;
|
| 297 |
--green-soft: rgba(76,175,80,0.15);
|
| 298 |
+
--input-bg: #252525;
|
| 299 |
+
--scrollbar: #555;
|
| 300 |
+
--radius: 4px;
|
| 301 |
+
--shadow: 0 2px 8px rgba(0,0,0,0.4);
|
| 302 |
+
--shadow-lg: 0 4px 20px rgba(0,0,0,0.5);
|
| 303 |
}}
|
| 304 |
|
| 305 |
+
* {{ box-sizing: border-box; margin: 0; padding: 0; }}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 306 |
|
| 307 |
html, body {{
|
| 308 |
+
background: var(--bg-3);
|
| 309 |
color: var(--text);
|
| 310 |
+
font-family: 'Ubuntu', sans-serif;
|
| 311 |
+
min-height: 100vh;
|
| 312 |
overflow-x: hidden;
|
| 313 |
}}
|
| 314 |
|
| 315 |
+
::-webkit-scrollbar {{ width: 6px; height: 6px; }}
|
| 316 |
+
::-webkit-scrollbar-track {{ background: var(--bg-3); }}
|
| 317 |
+
::-webkit-scrollbar-thumb {{ background: var(--scrollbar); border-radius: 3px; }}
|
| 318 |
+
|
| 319 |
+
/* ── TOP BAR ── */
|
| 320 |
.topbar {{
|
| 321 |
height: 52px;
|
| 322 |
+
background: #1a1a1a;
|
| 323 |
+
border-bottom: 1px solid #111;
|
| 324 |
display: flex;
|
| 325 |
align-items: center;
|
| 326 |
+
padding: 0 20px;
|
| 327 |
+
gap: 12px;
|
| 328 |
+
position: sticky;
|
| 329 |
+
top: 0;
|
| 330 |
+
z-index: 100;
|
| 331 |
}}
|
| 332 |
|
| 333 |
+
.topbar-dots {{
|
| 334 |
display: flex;
|
| 335 |
+
gap: 7px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 336 |
}}
|
| 337 |
|
| 338 |
+
.dot {{
|
| 339 |
+
width: 13px;
|
| 340 |
+
height: 13px;
|
| 341 |
+
border-radius: 50%;
|
|
|
|
| 342 |
flex-shrink: 0;
|
| 343 |
}}
|
| 344 |
|
| 345 |
+
.dot-red {{ background: #e95420; }}
|
| 346 |
+
.dot-yellow {{ background: #f4c21b; }}
|
| 347 |
+
.dot-green {{ background: #4caf50; }}
|
| 348 |
+
|
| 349 |
+
.topbar-title {{
|
| 350 |
+
margin-left: 8px;
|
| 351 |
+
font-size: 13px;
|
| 352 |
+
font-weight: 500;
|
| 353 |
+
color: var(--text-dim);
|
| 354 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 355 |
+
letter-spacing: 0.02em;
|
| 356 |
+
}}
|
| 357 |
+
|
| 358 |
+
.topbar-right {{
|
| 359 |
+
margin-left: auto;
|
| 360 |
+
display: flex;
|
| 361 |
+
align-items: center;
|
| 362 |
+
gap: 8px;
|
| 363 |
}}
|
| 364 |
|
| 365 |
+
.status-chip {{
|
| 366 |
+
display: flex;
|
| 367 |
+
align-items: center;
|
| 368 |
+
gap: 6px;
|
| 369 |
+
padding: 4px 10px;
|
| 370 |
+
background: var(--surface);
|
| 371 |
+
border: 1px solid var(--border);
|
| 372 |
+
border-radius: var(--radius);
|
| 373 |
font-size: 12px;
|
| 374 |
+
font-weight: 500;
|
| 375 |
+
color: var(--text-dim);
|
| 376 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 377 |
+
}}
|
| 378 |
+
|
| 379 |
+
.status-dot {{
|
| 380 |
+
width: 7px;
|
| 381 |
+
height: 7px;
|
| 382 |
+
border-radius: 50%;
|
| 383 |
+
background: var(--text-muted);
|
| 384 |
+
transition: background 0.3s;
|
| 385 |
}}
|
| 386 |
|
| 387 |
+
.status-dot.running {{ background: var(--orange); box-shadow: 0 0 6px var(--orange); animation: pulse 1s ease-in-out infinite; }}
|
| 388 |
+
.status-dot.done {{ background: var(--green); }}
|
| 389 |
+
|
| 390 |
+
@keyframes pulse {{ 0%,100% {{ opacity:1; }} 50% {{ opacity:0.4; }} }}
|
| 391 |
+
|
| 392 |
+
/* ── LAYOUT ── */
|
| 393 |
+
.app {{
|
| 394 |
+
max-width: 1300px;
|
| 395 |
margin: 0 auto;
|
| 396 |
+
padding: 24px 20px;
|
| 397 |
+
display: flex;
|
| 398 |
+
flex-direction: column;
|
| 399 |
+
gap: 20px;
|
| 400 |
}}
|
| 401 |
|
| 402 |
+
/* ── HERO ── */
|
| 403 |
.hero {{
|
| 404 |
+
background: var(--surface);
|
| 405 |
+
border: 1px solid var(--border);
|
| 406 |
+
border-radius: var(--radius);
|
| 407 |
+
padding: 24px 28px;
|
| 408 |
+
display: flex;
|
| 409 |
+
align-items: flex-start;
|
| 410 |
+
justify-content: space-between;
|
| 411 |
+
gap: 20px;
|
| 412 |
+
box-shadow: var(--shadow);
|
| 413 |
}}
|
| 414 |
|
| 415 |
+
.hero-left {{ display: flex; flex-direction: column; gap: 10px; }}
|
| 416 |
+
|
| 417 |
.hero-eyebrow {{
|
|
|
|
| 418 |
font-size: 12px;
|
| 419 |
+
font-weight: 400;
|
| 420 |
+
color: var(--orange-light);
|
| 421 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 422 |
+
letter-spacing: 0.06em;
|
| 423 |
text-transform: uppercase;
|
|
|
|
| 424 |
}}
|
| 425 |
|
| 426 |
.hero-title {{
|
| 427 |
+
font-size: 26px;
|
| 428 |
font-weight: 700;
|
| 429 |
+
color: var(--text);
|
| 430 |
+
line-height: 1.15;
|
| 431 |
+
letter-spacing: -0.01em;
|
| 432 |
}}
|
| 433 |
|
| 434 |
+
.hero-title span {{ color: var(--orange); }}
|
|
|
|
|
|
|
| 435 |
|
| 436 |
.hero-desc {{
|
| 437 |
+
font-size: 14px;
|
| 438 |
color: var(--text-dim);
|
| 439 |
line-height: 1.6;
|
| 440 |
+
max-width: 560px;
|
| 441 |
}}
|
| 442 |
|
| 443 |
+
.hero-badges {{
|
| 444 |
display: flex;
|
|
|
|
| 445 |
gap: 8px;
|
| 446 |
+
flex-wrap: wrap;
|
| 447 |
+
margin-top: 4px;
|
| 448 |
}}
|
| 449 |
|
| 450 |
+
.badge {{
|
| 451 |
display: inline-flex;
|
| 452 |
align-items: center;
|
| 453 |
gap: 6px;
|
| 454 |
+
padding: 5px 10px;
|
| 455 |
+
border-radius: var(--radius);
|
| 456 |
font-size: 12px;
|
| 457 |
font-weight: 500;
|
| 458 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 459 |
+
border: 1px solid;
|
|
|
|
|
|
|
| 460 |
}}
|
| 461 |
|
| 462 |
+
.badge-orange {{ color: #f4a07a; background: var(--orange-soft); border-color: var(--orange-border); }}
|
| 463 |
+
.badge-green {{ color: #86efac; background: var(--green-soft); border-color: rgba(76,175,80,0.4); }}
|
| 464 |
+
.badge-gray {{ color: var(--text-dim); background: rgba(255,255,255,0.06); border-color: var(--border); }}
|
|
|
|
|
|
|
| 465 |
|
| 466 |
+
/* ── MAIN GRID ── */
|
| 467 |
.main-grid {{
|
| 468 |
display: grid;
|
| 469 |
+
grid-template-columns: 380px 1fr;
|
| 470 |
gap: 20px;
|
| 471 |
align-items: start;
|
| 472 |
}}
|
| 473 |
|
| 474 |
+
/* ── PANEL ── */
|
| 475 |
.panel {{
|
| 476 |
background: var(--surface);
|
| 477 |
border: 1px solid var(--border);
|
| 478 |
+
border-radius: var(--radius);
|
| 479 |
+
overflow: hidden;
|
| 480 |
+
box-shadow: var(--shadow);
|
| 481 |
}}
|
| 482 |
|
| 483 |
.panel-header {{
|
| 484 |
+
height: 46px;
|
| 485 |
+
background: #282828;
|
| 486 |
border-bottom: 1px solid var(--border);
|
| 487 |
display: flex;
|
| 488 |
align-items: center;
|
|
|
|
| 489 |
padding: 0 16px;
|
| 490 |
+
gap: 10px;
|
| 491 |
+
}}
|
| 492 |
+
|
| 493 |
+
.panel-header-icon {{
|
| 494 |
+
width: 20px;
|
| 495 |
+
height: 20px;
|
| 496 |
+
color: var(--orange);
|
| 497 |
+
flex-shrink: 0;
|
| 498 |
}}
|
| 499 |
|
| 500 |
+
.panel-header-title {{
|
| 501 |
font-size: 13px;
|
| 502 |
font-weight: 700;
|
| 503 |
+
color: var(--text);
|
| 504 |
+
letter-spacing: 0.01em;
|
| 505 |
text-transform: uppercase;
|
| 506 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 507 |
}}
|
| 508 |
|
| 509 |
+
.panel-header-badge {{
|
| 510 |
+
margin-left: auto;
|
| 511 |
+
padding: 3px 8px;
|
| 512 |
+
background: var(--orange-soft);
|
| 513 |
+
border: 1px solid var(--orange-border);
|
| 514 |
+
border-radius: var(--radius);
|
| 515 |
+
font-size: 11px;
|
| 516 |
+
font-weight: 700;
|
| 517 |
+
color: var(--orange-light);
|
| 518 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 519 |
}}
|
| 520 |
|
| 521 |
+
.panel-body {{
|
| 522 |
+
padding: 16px;
|
| 523 |
display: flex;
|
| 524 |
flex-direction: column;
|
| 525 |
gap: 14px;
|
| 526 |
}}
|
| 527 |
|
| 528 |
+
/* ── FORM ELEMENTS ── */
|
| 529 |
+
.field {{ display: flex; flex-direction: column; gap: 6px; }}
|
| 530 |
+
|
| 531 |
+
.field-label {{
|
| 532 |
+
font-size: 12px;
|
| 533 |
+
font-weight: 700;
|
| 534 |
+
color: var(--text-dim);
|
| 535 |
+
text-transform: uppercase;
|
| 536 |
+
letter-spacing: 0.07em;
|
| 537 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 538 |
display: flex;
|
| 539 |
+
align-items: center;
|
| 540 |
gap: 6px;
|
| 541 |
}}
|
| 542 |
|
| 543 |
+
.field-label-dot {{
|
| 544 |
+
width: 5px;
|
| 545 |
+
height: 5px;
|
| 546 |
+
border-radius: 50%;
|
| 547 |
+
background: var(--orange);
|
| 548 |
+
flex-shrink: 0;
|
|
|
|
| 549 |
}}
|
| 550 |
|
| 551 |
+
.field-hint {{
|
| 552 |
+
font-size: 11px;
|
| 553 |
color: var(--text-muted);
|
| 554 |
line-height: 1.5;
|
| 555 |
}}
|
| 556 |
|
| 557 |
+
textarea, input[type="number"], input[type="text"] {{
|
|
|
|
|
|
|
|
|
|
|
|
|
| 558 |
width: 100%;
|
| 559 |
background: var(--input-bg);
|
| 560 |
+
border: 1px solid var(--border);
|
| 561 |
+
border-radius: var(--radius);
|
| 562 |
color: var(--text);
|
| 563 |
+
font-family: 'Ubuntu', sans-serif;
|
|
|
|
| 564 |
font-size: 14px;
|
| 565 |
+
outline: none;
|
| 566 |
+
transition: border-color 0.2s;
|
| 567 |
}}
|
| 568 |
|
| 569 |
+
textarea:focus, input[type="number"]:focus, input[type="text"]:focus {{
|
| 570 |
+
border-color: var(--border-focus);
|
| 571 |
}}
|
| 572 |
|
| 573 |
+
textarea {{
|
| 574 |
+
padding: 10px 12px;
|
| 575 |
min-height: 90px;
|
| 576 |
resize: vertical;
|
| 577 |
line-height: 1.55;
|
| 578 |
}}
|
| 579 |
|
| 580 |
+
input[type="number"] {{
|
| 581 |
+
padding: 8px 10px;
|
| 582 |
+
}}
|
| 583 |
+
|
| 584 |
+
input[type="range"] {{
|
| 585 |
+
-webkit-appearance: none;
|
| 586 |
+
width: 100%;
|
| 587 |
+
height: 4px;
|
| 588 |
+
background: var(--surface-3);
|
| 589 |
+
border-radius: 2px;
|
| 590 |
+
outline: none;
|
| 591 |
+
}}
|
| 592 |
+
|
| 593 |
+
input[type="range"]::-webkit-slider-thumb {{
|
| 594 |
+
-webkit-appearance: none;
|
| 595 |
+
width: 16px;
|
| 596 |
+
height: 16px;
|
| 597 |
+
border-radius: 50%;
|
| 598 |
+
background: var(--orange);
|
| 599 |
+
cursor: pointer;
|
| 600 |
+
box-shadow: 0 0 6px rgba(233,84,32,0.5);
|
| 601 |
+
}}
|
| 602 |
+
|
| 603 |
+
/* ── UPLOAD ZONE ── */
|
| 604 |
.upload-zone {{
|
| 605 |
background: var(--input-bg);
|
| 606 |
+
border: 2px dashed var(--border);
|
| 607 |
+
border-radius: var(--radius);
|
| 608 |
+
transition: border-color 0.2s, background 0.2s;
|
| 609 |
cursor: pointer;
|
| 610 |
+
}}
|
| 611 |
+
|
| 612 |
+
.upload-zone:hover {{
|
| 613 |
+
border-color: var(--orange);
|
| 614 |
+
background: rgba(233,84,32,0.05);
|
| 615 |
}}
|
| 616 |
|
| 617 |
.upload-zone.dragover {{
|
|
|
|
| 619 |
background: var(--orange-soft);
|
| 620 |
}}
|
| 621 |
|
| 622 |
+
.upload-zone input[type="file"] {{ display: none; }}
|
|
|
|
|
|
|
| 623 |
|
| 624 |
.upload-placeholder {{
|
| 625 |
+
padding: 24px 16px;
|
| 626 |
display: flex;
|
| 627 |
flex-direction: column;
|
| 628 |
align-items: center;
|
| 629 |
justify-content: center;
|
| 630 |
gap: 10px;
|
|
|
|
| 631 |
text-align: center;
|
| 632 |
cursor: pointer;
|
|
|
|
| 633 |
border: none;
|
| 634 |
+
background: transparent;
|
| 635 |
width: 100%;
|
| 636 |
+
color: var(--text);
|
| 637 |
}}
|
| 638 |
|
| 639 |
.upload-icon-wrap {{
|
| 640 |
width: 48px;
|
| 641 |
height: 48px;
|
|
|
|
| 642 |
background: var(--surface-2);
|
| 643 |
+
border: 1px solid var(--border);
|
| 644 |
+
border-radius: var(--radius);
|
| 645 |
display: flex;
|
| 646 |
align-items: center;
|
| 647 |
justify-content: center;
|
| 648 |
color: var(--orange);
|
|
|
|
| 649 |
}}
|
| 650 |
|
| 651 |
+
.upload-text-main {{
|
| 652 |
font-size: 13px;
|
| 653 |
font-weight: 700;
|
| 654 |
color: var(--text);
|
| 655 |
}}
|
| 656 |
|
| 657 |
+
.upload-text-sub {{
|
| 658 |
font-size: 12px;
|
| 659 |
color: var(--text-muted);
|
| 660 |
}}
|
| 661 |
|
| 662 |
+
/* ── PREVIEW GRID ── */
|
| 663 |
+
.preview-container {{
|
| 664 |
display: flex;
|
| 665 |
+
flex-direction: column;
|
| 666 |
+
gap: 10px;
|
|
|
|
| 667 |
}}
|
| 668 |
|
| 669 |
+
.preview-header {{
|
| 670 |
+
display: flex;
|
| 671 |
+
align-items: center;
|
| 672 |
+
justify-content: space-between;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 673 |
}}
|
| 674 |
|
| 675 |
+
.preview-count {{
|
| 676 |
+
font-size: 12px;
|
| 677 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 678 |
+
color: var(--orange-light);
|
| 679 |
+
font-weight: 700;
|
| 680 |
}}
|
| 681 |
|
| 682 |
+
.preview-clear {{
|
| 683 |
+
padding: 3px 8px;
|
| 684 |
+
background: transparent;
|
| 685 |
+
border: 1px solid var(--border);
|
| 686 |
+
border-radius: var(--radius);
|
| 687 |
+
color: var(--text-muted);
|
| 688 |
+
font-size: 11px;
|
| 689 |
+
font-family: 'Ubuntu', sans-serif;
|
| 690 |
+
cursor: pointer;
|
| 691 |
+
transition: all 0.2s;
|
| 692 |
+
}}
|
| 693 |
+
|
| 694 |
+
.preview-clear:hover {{
|
| 695 |
+
border-color: var(--orange);
|
| 696 |
+
color: var(--orange);
|
| 697 |
+
}}
|
| 698 |
+
|
| 699 |
+
.preview-grid {{
|
| 700 |
+
display: grid;
|
| 701 |
+
grid-template-columns: repeat(3, 1fr);
|
| 702 |
+
gap: 8px;
|
| 703 |
+
}}
|
| 704 |
+
|
| 705 |
+
.thumb {{
|
| 706 |
+
position: relative;
|
| 707 |
+
aspect-ratio: 1/1;
|
| 708 |
+
border-radius: var(--radius);
|
| 709 |
+
overflow: hidden;
|
| 710 |
+
border: 1px solid var(--border);
|
| 711 |
+
background: #111;
|
| 712 |
+
cursor: grab;
|
| 713 |
+
}}
|
| 714 |
+
|
| 715 |
+
.thumb.dragging {{ opacity: 0.5; border-color: var(--orange); }}
|
| 716 |
+
|
| 717 |
+
.thumb img {{
|
| 718 |
+
width: 100%;
|
| 719 |
+
height: 100%;
|
| 720 |
+
object-fit: cover;
|
| 721 |
+
display: block;
|
| 722 |
+
}}
|
| 723 |
+
|
| 724 |
+
.thumb-overlay {{
|
| 725 |
+
position: absolute;
|
| 726 |
+
inset: 0;
|
| 727 |
+
background: rgba(0,0,0,0);
|
| 728 |
+
transition: background 0.2s;
|
| 729 |
+
display: flex;
|
| 730 |
+
align-items: flex-start;
|
| 731 |
+
justify-content: flex-end;
|
| 732 |
+
padding: 5px;
|
| 733 |
+
}}
|
| 734 |
+
|
| 735 |
+
.thumb:hover .thumb-overlay {{ background: rgba(0,0,0,0.35); }}
|
| 736 |
+
|
| 737 |
+
.thumb-remove {{
|
| 738 |
+
width: 22px;
|
| 739 |
+
height: 22px;
|
| 740 |
+
border-radius: 50%;
|
| 741 |
+
background: rgba(20,20,20,0.9);
|
| 742 |
border: 1px solid var(--border);
|
|
|
|
| 743 |
color: white;
|
| 744 |
+
font-size: 14px;
|
| 745 |
+
line-height: 1;
|
| 746 |
cursor: pointer;
|
| 747 |
display: flex;
|
| 748 |
align-items: center;
|
| 749 |
justify-content: center;
|
| 750 |
+
opacity: 0;
|
| 751 |
+
transition: opacity 0.2s;
|
| 752 |
}}
|
| 753 |
|
| 754 |
+
.thumb:hover .thumb-remove {{ opacity: 1; }}
|
| 755 |
+
|
| 756 |
+
.thumb-num {{
|
| 757 |
+
position: absolute;
|
| 758 |
+
bottom: 5px;
|
| 759 |
+
left: 5px;
|
| 760 |
+
width: 18px;
|
| 761 |
+
height: 18px;
|
| 762 |
+
border-radius: 50%;
|
| 763 |
+
background: var(--orange);
|
| 764 |
+
color: white;
|
| 765 |
+
font-size: 10px;
|
| 766 |
+
font-weight: 700;
|
| 767 |
+
display: flex;
|
| 768 |
+
align-items: center;
|
| 769 |
+
justify-content: center;
|
| 770 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 771 |
+
}}
|
| 772 |
+
|
| 773 |
+
.upload-add-more {{
|
| 774 |
+
aspect-ratio: 1/1;
|
| 775 |
+
border-radius: var(--radius);
|
| 776 |
+
border: 2px dashed var(--border);
|
| 777 |
+
background: var(--input-bg);
|
| 778 |
display: flex;
|
| 779 |
align-items: center;
|
| 780 |
justify-content: center;
|
| 781 |
cursor: pointer;
|
| 782 |
+
color: var(--text-muted);
|
| 783 |
+
font-size: 24px;
|
| 784 |
+
transition: all 0.2s;
|
| 785 |
}}
|
| 786 |
|
| 787 |
+
.upload-add-more:hover {{
|
| 788 |
border-color: var(--orange);
|
| 789 |
color: var(--orange);
|
| 790 |
}}
|
| 791 |
|
| 792 |
+
/* ── ADVANCED ── */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 793 |
.advanced-toggle {{
|
| 794 |
width: 100%;
|
| 795 |
+
padding: 8px 12px;
|
| 796 |
+
background: var(--input-bg);
|
| 797 |
+
border: 1px solid var(--border);
|
| 798 |
+
border-radius: var(--radius);
|
| 799 |
color: var(--text-dim);
|
| 800 |
+
font-family: 'Ubuntu', sans-serif;
|
| 801 |
+
font-size: 13px;
|
| 802 |
+
font-weight: 500;
|
| 803 |
+
cursor: pointer;
|
| 804 |
display: flex;
|
| 805 |
align-items: center;
|
| 806 |
justify-content: space-between;
|
| 807 |
+
transition: all 0.2s;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 808 |
}}
|
| 809 |
|
| 810 |
+
.advanced-toggle:hover {{ border-color: var(--orange); color: var(--text); }}
|
|
|
|
|
|
|
| 811 |
|
| 812 |
+
.chevron {{
|
| 813 |
+
transition: transform 0.25s;
|
| 814 |
+
font-size: 10px;
|
| 815 |
}}
|
| 816 |
|
| 817 |
+
.chevron.open {{ transform: rotate(180deg); }}
|
| 818 |
+
|
| 819 |
.advanced-body {{
|
| 820 |
display: none;
|
| 821 |
+
flex-direction: column;
|
| 822 |
+
gap: 12px;
|
| 823 |
+
padding: 12px;
|
| 824 |
+
background: var(--input-bg);
|
| 825 |
+
border: 1px solid var(--border);
|
| 826 |
+
border-radius: var(--radius);
|
| 827 |
+
margin-top: -6px;
|
| 828 |
}}
|
| 829 |
|
| 830 |
+
.advanced-body.open {{ display: flex; }}
|
|
|
|
|
|
|
| 831 |
|
| 832 |
+
.adv-grid {{ display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 833 |
|
| 834 |
+
.slider-row {{ display: flex; flex-direction: column; gap: 5px; }}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 835 |
|
| 836 |
+
.slider-label-row {{
|
| 837 |
display: flex;
|
| 838 |
align-items: center;
|
| 839 |
+
justify-content: space-between;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 840 |
font-size: 12px;
|
| 841 |
color: var(--text-dim);
|
| 842 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 843 |
+
}}
|
| 844 |
+
|
| 845 |
+
.slider-val {{
|
| 846 |
+
color: var(--orange-light);
|
| 847 |
+
font-weight: 700;
|
| 848 |
}}
|
| 849 |
|
| 850 |
.checkbox-row {{
|
|
|
|
| 853 |
gap: 8px;
|
| 854 |
font-size: 13px;
|
| 855 |
color: var(--text-dim);
|
|
|
|
| 856 |
}}
|
| 857 |
|
| 858 |
+
.checkbox-row input {{ width: 15px; height: 15px; accent-color: var(--orange); }}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 859 |
|
| 860 |
+
/* ── RUN BUTTON ── */
|
| 861 |
+
.run-btn {{
|
| 862 |
+
width: 100%;
|
| 863 |
+
height: 44px;
|
| 864 |
+
background: var(--orange);
|
| 865 |
+
border: none;
|
| 866 |
+
border-radius: var(--radius);
|
| 867 |
+
color: white;
|
| 868 |
+
font-family: 'Ubuntu', sans-serif;
|
| 869 |
+
font-size: 15px;
|
| 870 |
+
font-weight: 700;
|
| 871 |
+
cursor: pointer;
|
| 872 |
+
display: flex;
|
| 873 |
+
align-items: center;
|
| 874 |
+
justify-content: center;
|
| 875 |
+
gap: 8px;
|
| 876 |
+
letter-spacing: 0.02em;
|
| 877 |
+
transition: background 0.2s, transform 0.1s;
|
| 878 |
+
box-shadow: 0 2px 10px rgba(233,84,32,0.35);
|
| 879 |
}}
|
| 880 |
|
| 881 |
+
.run-btn:hover {{ background: var(--orange-hover); transform: translateY(-1px); }}
|
| 882 |
+
.run-btn:active {{ transform: translateY(0); }}
|
| 883 |
+
.run-btn:disabled {{ background: var(--surface-3); box-shadow: none; cursor: not-allowed; transform: none; }}
|
| 884 |
+
|
| 885 |
+
/* ── RESULT PANEL ── */
|
| 886 |
+
.result-panel {{
|
| 887 |
+
background: var(--surface);
|
| 888 |
border: 1px solid var(--border);
|
| 889 |
+
border-radius: var(--radius);
|
| 890 |
+
overflow: hidden;
|
| 891 |
+
box-shadow: var(--shadow);
|
| 892 |
+
}}
|
| 893 |
+
|
| 894 |
+
.result-header {{
|
| 895 |
+
height: 46px;
|
| 896 |
+
background: #282828;
|
| 897 |
+
border-bottom: 1px solid var(--border);
|
| 898 |
+
display: flex;
|
| 899 |
+
align-items: center;
|
| 900 |
+
padding: 0 16px;
|
| 901 |
+
gap: 12px;
|
| 902 |
+
}}
|
| 903 |
+
|
| 904 |
+
.result-header-title {{
|
| 905 |
font-size: 13px;
|
| 906 |
font-weight: 700;
|
| 907 |
+
color: var(--text);
|
|
|
|
| 908 |
text-transform: uppercase;
|
| 909 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 910 |
}}
|
| 911 |
|
| 912 |
+
.result-meta-row {{
|
| 913 |
+
margin-left: auto;
|
| 914 |
+
display: flex;
|
| 915 |
+
gap: 8px;
|
| 916 |
+
align-items: center;
|
| 917 |
}}
|
| 918 |
|
| 919 |
+
.meta-chip {{
|
| 920 |
+
padding: 3px 8px;
|
| 921 |
+
background: var(--surface-2);
|
| 922 |
+
border: 1px solid var(--border);
|
| 923 |
+
border-radius: var(--radius);
|
| 924 |
+
font-size: 11px;
|
| 925 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 926 |
+
color: var(--text-dim);
|
| 927 |
}}
|
| 928 |
|
| 929 |
+
.meta-chip span {{ color: var(--orange-light); font-weight: 700; }}
|
| 930 |
+
|
| 931 |
+
/* ── IMAGE SLIDER ── */
|
| 932 |
+
.slider-stage {{
|
| 933 |
+
position: relative;
|
| 934 |
+
background: #111;
|
| 935 |
+
overflow: hidden;
|
| 936 |
}}
|
| 937 |
|
| 938 |
+
.slider-stage.empty {{
|
| 939 |
+
min-height: 480px;
|
| 940 |
+
display: flex;
|
| 941 |
+
align-items: center;
|
| 942 |
+
justify-content: center;
|
| 943 |
}}
|
| 944 |
|
| 945 |
+
.empty-state {{
|
|
|
|
| 946 |
display: flex;
|
| 947 |
flex-direction: column;
|
| 948 |
+
align-items: center;
|
| 949 |
+
gap: 14px;
|
| 950 |
+
color: var(--text-muted);
|
| 951 |
+
text-align: center;
|
| 952 |
+
padding: 40px;
|
| 953 |
+
}}
|
| 954 |
+
|
| 955 |
+
.empty-icon {{
|
| 956 |
+
width: 64px;
|
| 957 |
+
height: 64px;
|
| 958 |
+
border: 1px solid var(--border);
|
| 959 |
+
background: var(--surface-2);
|
| 960 |
+
border-radius: var(--radius);
|
| 961 |
+
display: flex;
|
| 962 |
+
align-items: center;
|
| 963 |
+
justify-content: center;
|
| 964 |
+
color: var(--orange);
|
| 965 |
+
}}
|
| 966 |
+
|
| 967 |
+
.empty-title {{
|
| 968 |
+
font-size: 15px;
|
| 969 |
+
font-weight: 700;
|
| 970 |
+
color: var(--text);
|
| 971 |
+
}}
|
| 972 |
+
|
| 973 |
+
.empty-sub {{
|
| 974 |
+
font-size: 13px;
|
| 975 |
+
color: var(--text-muted);
|
| 976 |
}}
|
| 977 |
|
| 978 |
+
/* compare slider */
|
| 979 |
+
.compare-wrap {{
|
| 980 |
position: relative;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 981 |
user-select: none;
|
| 982 |
+
display: none;
|
| 983 |
}}
|
| 984 |
|
| 985 |
+
.compare-wrap.visible {{ display: block; }}
|
|
|
|
|
|
|
| 986 |
|
| 987 |
+
.compare-img {{
|
| 988 |
+
display: block;
|
|
|
|
| 989 |
width: 100%;
|
| 990 |
+
height: auto;
|
|
|
|
| 991 |
}}
|
| 992 |
|
| 993 |
+
.compare-overlay {{
|
| 994 |
+
position: absolute;
|
| 995 |
+
top: 0;
|
| 996 |
+
left: 0;
|
| 997 |
+
height: 100%;
|
| 998 |
+
overflow: hidden;
|
| 999 |
}}
|
| 1000 |
|
| 1001 |
+
.compare-overlay img {{
|
| 1002 |
+
display: block;
|
| 1003 |
+
width: 100%;
|
| 1004 |
+
height: 100%;
|
| 1005 |
+
object-fit: cover;
|
| 1006 |
+
object-position: left top;
|
| 1007 |
}}
|
| 1008 |
|
| 1009 |
+
.compare-handle {{
|
| 1010 |
position: absolute;
|
| 1011 |
top: 0;
|
| 1012 |
+
height: 100%;
|
|
|
|
| 1013 |
width: 2px;
|
| 1014 |
background: white;
|
| 1015 |
+
cursor: ew-resize;
|
| 1016 |
+
z-index: 10;
|
|
|
|
| 1017 |
}}
|
| 1018 |
|
| 1019 |
+
.compare-handle::before {{
|
| 1020 |
+
content: '';
|
| 1021 |
position: absolute;
|
| 1022 |
top: 50%;
|
| 1023 |
left: 50%;
|
| 1024 |
transform: translate(-50%, -50%);
|
| 1025 |
+
width: 36px;
|
| 1026 |
+
height: 36px;
|
| 1027 |
+
border-radius: 50%;
|
| 1028 |
background: white;
|
| 1029 |
+
box-shadow: 0 2px 10px rgba(0,0,0,0.5);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1030 |
}}
|
| 1031 |
|
| 1032 |
+
.compare-handle::after {{
|
| 1033 |
+
content: '◀ ▶';
|
| 1034 |
+
position: absolute;
|
| 1035 |
+
top: 50%;
|
| 1036 |
+
left: 50%;
|
| 1037 |
+
transform: translate(-50%, -50%);
|
| 1038 |
+
font-size: 10px;
|
| 1039 |
+
color: #333;
|
| 1040 |
+
pointer-events: none;
|
| 1041 |
+
white-space: nowrap;
|
| 1042 |
+
}}
|
| 1043 |
+
|
| 1044 |
+
/* labels on compare */
|
| 1045 |
+
.compare-label {{
|
| 1046 |
position: absolute;
|
| 1047 |
top: 12px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1048 |
padding: 4px 10px;
|
| 1049 |
+
border-radius: var(--radius);
|
| 1050 |
+
font-size: 12px;
|
| 1051 |
+
font-weight: 700;
|
| 1052 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 1053 |
pointer-events: none;
|
| 1054 |
+
z-index: 5;
|
| 1055 |
}}
|
| 1056 |
|
| 1057 |
+
.compare-label-left {{
|
| 1058 |
left: 12px;
|
| 1059 |
+
background: rgba(233,84,32,0.9);
|
| 1060 |
color: white;
|
| 1061 |
}}
|
| 1062 |
|
| 1063 |
+
.compare-label-right {{
|
| 1064 |
right: 12px;
|
| 1065 |
+
background: rgba(40,40,40,0.85);
|
| 1066 |
color: var(--text);
|
| 1067 |
border: 1px solid var(--border);
|
| 1068 |
}}
|
| 1069 |
|
| 1070 |
+
/* ── RESULT FOOTER ── */
|
| 1071 |
+
.result-footer {{
|
| 1072 |
+
padding: 12px 16px;
|
| 1073 |
+
border-top: 1px solid var(--border);
|
| 1074 |
display: flex;
|
|
|
|
| 1075 |
align-items: center;
|
| 1076 |
+
gap: 10px;
|
| 1077 |
+
flex-wrap: wrap;
|
| 1078 |
+
background: #282828;
|
|
|
|
|
|
|
|
|
|
| 1079 |
}}
|
| 1080 |
|
| 1081 |
+
.dl-btn {{
|
| 1082 |
+
display: inline-flex;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1083 |
align-items: center;
|
| 1084 |
+
gap: 6px;
|
| 1085 |
+
padding: 6px 12px;
|
| 1086 |
+
border-radius: var(--radius);
|
| 1087 |
+
font-size: 12px;
|
| 1088 |
+
font-weight: 700;
|
| 1089 |
+
font-family: 'Ubuntu', sans-serif;
|
| 1090 |
+
text-decoration: none;
|
| 1091 |
+
border: 1px solid var(--border);
|
| 1092 |
+
background: var(--surface-2);
|
| 1093 |
+
color: var(--text);
|
| 1094 |
+
cursor: pointer;
|
| 1095 |
+
transition: all 0.2s;
|
| 1096 |
+
}}
|
| 1097 |
+
|
| 1098 |
+
.dl-btn:hover {{ border-color: var(--orange); color: var(--orange); }}
|
| 1099 |
+
.dl-btn.hidden {{ display: none; }}
|
| 1100 |
+
|
| 1101 |
+
.seed-display {{
|
| 1102 |
+
margin-left: auto;
|
| 1103 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 1104 |
+
font-size: 12px;
|
| 1105 |
+
color: var(--text-muted);
|
| 1106 |
}}
|
| 1107 |
|
| 1108 |
+
.seed-display span {{ color: var(--orange-light); font-weight: 700; }}
|
| 1109 |
+
|
| 1110 |
+
/* ── LOADER ── */
|
| 1111 |
.loader-overlay {{
|
| 1112 |
position: absolute;
|
| 1113 |
inset: 0;
|
| 1114 |
+
background: rgba(20,20,20,0.75);
|
| 1115 |
+
backdrop-filter: blur(8px);
|
| 1116 |
+
-webkit-backdrop-filter: blur(8px);
|
| 1117 |
display: none;
|
|
|
|
| 1118 |
align-items: center;
|
| 1119 |
justify-content: center;
|
| 1120 |
+
flex-direction: column;
|
| 1121 |
gap: 16px;
|
| 1122 |
+
z-index: 20;
|
|
|
|
|
|
|
|
|
|
| 1123 |
}}
|
| 1124 |
|
| 1125 |
+
.loader-overlay.active {{ display: flex; }}
|
| 1126 |
+
|
| 1127 |
+
.loader-ring {{
|
| 1128 |
width: 52px;
|
| 1129 |
height: 52px;
|
| 1130 |
+
border-radius: 50%;
|
| 1131 |
+
border: 3px solid rgba(233,84,32,0.25);
|
| 1132 |
border-top-color: var(--orange);
|
|
|
|
| 1133 |
animation: spin 0.85s linear infinite;
|
| 1134 |
}}
|
| 1135 |
|
| 1136 |
.loader-text {{
|
|
|
|
| 1137 |
font-size: 13px;
|
| 1138 |
+
font-weight: 500;
|
| 1139 |
+
color: white;
|
| 1140 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 1141 |
+
letter-spacing: 0.05em;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1142 |
}}
|
| 1143 |
|
| 1144 |
+
@keyframes spin {{ to {{ transform: rotate(360deg); }} }}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1145 |
|
| 1146 |
+
/* ── EXAMPLES ── */
|
| 1147 |
+
.examples-panel {{
|
|
|
|
| 1148 |
background: var(--surface);
|
| 1149 |
border: 1px solid var(--border);
|
| 1150 |
+
border-radius: var(--radius);
|
| 1151 |
+
overflow: hidden;
|
| 1152 |
+
box-shadow: var(--shadow);
|
| 1153 |
}}
|
| 1154 |
|
| 1155 |
.examples-header {{
|
| 1156 |
+
height: 46px;
|
| 1157 |
+
background: #282828;
|
| 1158 |
border-bottom: 1px solid var(--border);
|
| 1159 |
display: flex;
|
| 1160 |
align-items: center;
|
| 1161 |
padding: 0 16px;
|
| 1162 |
+
gap: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1163 |
}}
|
| 1164 |
|
| 1165 |
.examples-grid {{
|
| 1166 |
+
padding: 16px;
|
| 1167 |
display: grid;
|
| 1168 |
+
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
| 1169 |
+
gap: 14px;
|
| 1170 |
}}
|
| 1171 |
|
| 1172 |
.example-card {{
|
| 1173 |
+
background: var(--bg);
|
| 1174 |
+
border: 1px solid var(--border);
|
| 1175 |
+
border-radius: var(--radius);
|
| 1176 |
overflow: hidden;
|
| 1177 |
+
cursor: pointer;
|
| 1178 |
+
transition: border-color 0.2s, transform 0.15s;
|
| 1179 |
}}
|
| 1180 |
|
| 1181 |
.example-card:hover {{
|
| 1182 |
border-color: var(--orange);
|
| 1183 |
+
transform: translateY(-2px);
|
| 1184 |
+
}}
|
| 1185 |
+
|
| 1186 |
+
.example-img-wrap {{
|
| 1187 |
+
position: relative;
|
| 1188 |
+
aspect-ratio: 4/3;
|
| 1189 |
+
overflow: hidden;
|
| 1190 |
}}
|
| 1191 |
|
| 1192 |
+
.example-img-wrap img {{
|
| 1193 |
width: 100%;
|
| 1194 |
+
height: 100%;
|
| 1195 |
object-fit: cover;
|
| 1196 |
display: block;
|
| 1197 |
+
transition: transform 0.3s;
|
| 1198 |
}}
|
| 1199 |
|
| 1200 |
+
.example-card:hover .example-img-wrap img {{ transform: scale(1.04); }}
|
| 1201 |
+
|
| 1202 |
.example-card-body {{
|
| 1203 |
+
padding: 10px 12px;
|
| 1204 |
}}
|
| 1205 |
|
| 1206 |
+
.example-prompt {{
|
| 1207 |
font-size: 12px;
|
| 1208 |
color: var(--text-dim);
|
| 1209 |
line-height: 1.5;
|
| 1210 |
+
display: -webkit-box;
|
| 1211 |
+
-webkit-line-clamp: 2;
|
| 1212 |
+
-webkit-box-orient: vertical;
|
| 1213 |
+
overflow: hidden;
|
| 1214 |
}}
|
| 1215 |
|
| 1216 |
+
.use-example-btn {{
|
| 1217 |
+
margin-top: 8px;
|
| 1218 |
+
width: 100%;
|
| 1219 |
+
padding: 5px;
|
| 1220 |
+
background: var(--orange-soft);
|
| 1221 |
+
border: 1px solid var(--orange-border);
|
| 1222 |
+
border-radius: var(--radius);
|
| 1223 |
+
color: var(--orange-light);
|
| 1224 |
+
font-size: 11px;
|
| 1225 |
+
font-weight: 700;
|
| 1226 |
+
font-family: 'Ubuntu Mono', monospace;
|
| 1227 |
+
cursor: pointer;
|
| 1228 |
+
transition: background 0.2s;
|
| 1229 |
+
}}
|
| 1230 |
+
|
| 1231 |
+
.use-example-btn:hover {{ background: rgba(233,84,32,0.25); }}
|
| 1232 |
+
|
| 1233 |
+
/* ── TOAST ── */
|
| 1234 |
.toast-wrap {{
|
| 1235 |
position: fixed;
|
| 1236 |
+
bottom: 20px;
|
| 1237 |
+
right: 20px;
|
| 1238 |
z-index: 9999;
|
| 1239 |
display: flex;
|
| 1240 |
flex-direction: column;
|
|
|
|
| 1242 |
}}
|
| 1243 |
|
| 1244 |
.toast {{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1245 |
display: flex;
|
| 1246 |
align-items: flex-start;
|
|
|
|
| 1247 |
gap: 10px;
|
| 1248 |
+
padding: 12px 14px;
|
| 1249 |
+
background: #1e1e1e;
|
| 1250 |
+
border: 1px solid var(--border);
|
| 1251 |
+
border-radius: var(--radius);
|
| 1252 |
+
box-shadow: var(--shadow-lg);
|
| 1253 |
+
min-width: 240px;
|
| 1254 |
+
max-width: 340px;
|
| 1255 |
+
animation: slideIn 0.25s ease;
|
| 1256 |
}}
|
| 1257 |
|
| 1258 |
+
.toast-error {{ border-color: rgba(239,68,68,0.5); }}
|
| 1259 |
+
.toast-success {{ border-color: rgba(76,175,80,0.5); }}
|
| 1260 |
+
|
| 1261 |
+
.toast-msg {{ font-size: 13px; color: var(--text); flex: 1; line-height: 1.45; }}
|
| 1262 |
+
|
| 1263 |
+
.toast-close {{
|
| 1264 |
background: transparent;
|
| 1265 |
+
border: none;
|
| 1266 |
color: var(--text-muted);
|
| 1267 |
font-size: 16px;
|
| 1268 |
cursor: pointer;
|
|
|
|
| 1269 |
line-height: 1;
|
| 1270 |
+
padding: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1271 |
}}
|
| 1272 |
|
| 1273 |
+
@keyframes slideIn {{
|
| 1274 |
+
from {{ transform: translateX(20px); opacity: 0; }}
|
| 1275 |
+
to {{ transform: translateX(0); opacity: 1; }}
|
|
|
|
|
|
|
| 1276 |
}}
|
| 1277 |
|
| 1278 |
+
/* ── RESPONSIVE ── */
|
| 1279 |
+
@media (max-width: 900px) {{
|
| 1280 |
+
.main-grid {{ grid-template-columns: 1fr; }}
|
| 1281 |
+
.hero {{ flex-direction: column; }}
|
|
|
|
|
|
|
|
|
|
| 1282 |
}}
|
| 1283 |
|
| 1284 |
+
@media (max-width: 600px) {{
|
| 1285 |
+
.app {{ padding: 14px 12px; }}
|
| 1286 |
+
.hero-title {{ font-size: 20px; }}
|
| 1287 |
+
.adv-grid {{ grid-template-columns: 1fr; }}
|
| 1288 |
+
.preview-grid {{ grid-template-columns: repeat(3, 1fr); }}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1289 |
}}
|
| 1290 |
</style>
|
| 1291 |
</head>
|
| 1292 |
<body>
|
| 1293 |
|
| 1294 |
+
<div class="toast-wrap" id="toastWrap"></div>
|
| 1295 |
|
| 1296 |
+
<!-- TOP BAR -->
|
| 1297 |
+
<div class="topbar">
|
| 1298 |
+
<div class="topbar-dots">
|
| 1299 |
+
<div class="dot dot-red"></div>
|
| 1300 |
+
<div class="dot dot-yellow"></div>
|
| 1301 |
+
<div class="dot dot-green"></div>
|
| 1302 |
+
</div>
|
| 1303 |
+
<div class="topbar-title">flux2-klein — vae-decoder-comparator</div>
|
| 1304 |
+
<div class="topbar-right">
|
| 1305 |
+
<div class="status-chip">
|
| 1306 |
+
<div class="status-dot" id="statusDot"></div>
|
| 1307 |
+
<span id="statusText">idle</span>
|
| 1308 |
+
</div>
|
| 1309 |
+
<div class="status-chip" style="color:var(--orange-light);">{DEVICE_LABEL}</div>
|
| 1310 |
+
</div>
|
| 1311 |
</div>
|
| 1312 |
+
|
| 1313 |
+
<div class="app">
|
| 1314 |
+
|
| 1315 |
+
<!-- HERO -->
|
| 1316 |
+
<div class="hero">
|
| 1317 |
+
<div class="hero-left">
|
| 1318 |
+
<div class="hero-eyebrow">black-forest-labs / flux.2-klein-4b / decoder comparison</div>
|
| 1319 |
+
<h1 class="hero-title">FLUX.2 <span>Decoder</span> Comparator</h1>
|
| 1320 |
+
<p class="hero-desc">
|
| 1321 |
+
Run both <strong>Standard VAE</strong> and <strong>Small Decoder</strong> in parallel on the same prompt,
|
| 1322 |
+
then compare results interactively with a drag slider.
|
| 1323 |
+
</p>
|
| 1324 |
+
<div class="hero-badges">
|
| 1325 |
+
<span class="badge badge-orange">⚡ parallel inference</span>
|
| 1326 |
+
<span class="badge badge-green">🖼 image-to-image</span>
|
| 1327 |
+
<span class="badge badge-gray">4-step distilled</span>
|
| 1328 |
+
<span class="badge badge-gray">flux.2-klein-4b</span>
|
| 1329 |
+
</div>
|
| 1330 |
+
</div>
|
|
|
|
| 1331 |
</div>
|
|
|
|
| 1332 |
|
| 1333 |
+
<!-- MAIN -->
|
| 1334 |
+
<div class="main-grid">
|
| 1335 |
|
| 1336 |
+
<!-- INPUT PANEL -->
|
| 1337 |
+
<div class="panel">
|
| 1338 |
+
<div class="panel-header">
|
| 1339 |
+
<svg class="panel-header-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 1340 |
+
<path d="M12 4v16M4 12h16"/>
|
| 1341 |
+
</svg>
|
| 1342 |
+
<span class="panel-header-title">Input</span>
|
| 1343 |
+
<span class="panel-header-badge">CONFIGURE</span>
|
| 1344 |
+
</div>
|
| 1345 |
+
<div class="panel-body">
|
| 1346 |
|
| 1347 |
+
<!-- Upload -->
|
| 1348 |
+
<div class="field">
|
| 1349 |
+
<div class="field-label"><span class="field-label-dot"></span>Input Images <span style="color:var(--text-muted);font-weight:400;">(optional)</span></div>
|
| 1350 |
<div class="upload-zone" id="uploadZone">
|
| 1351 |
<input id="fileInput" type="file" accept="image/*" multiple />
|
| 1352 |
<button class="upload-placeholder" id="uploadPlaceholder" type="button">
|
| 1353 |
<div class="upload-icon-wrap">
|
| 1354 |
+
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 1355 |
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
| 1356 |
+
<polyline points="17 8 12 3 7 8"/>
|
| 1357 |
+
<line x1="12" y1="3" x2="12" y2="15"/>
|
| 1358 |
</svg>
|
| 1359 |
</div>
|
| 1360 |
+
<div class="upload-text-main">Drop images or click to browse</div>
|
| 1361 |
+
<div class="upload-text-sub">PNG, JPG, WEBP · multiple files supported</div>
|
|
|
|
|
|
|
| 1362 |
</button>
|
|
|
|
| 1363 |
</div>
|
| 1364 |
+
<div id="previewContainer" style="display:none;">
|
| 1365 |
+
<div class="preview-container">
|
| 1366 |
+
<div class="preview-header">
|
| 1367 |
+
<span class="preview-count" id="previewCount">0 images</span>
|
| 1368 |
+
<button class="preview-clear" id="clearImagesBtn" type="button">Clear all</button>
|
| 1369 |
+
</div>
|
| 1370 |
+
<div class="preview-grid" id="previewGrid"></div>
|
| 1371 |
+
</div>
|
| 1372 |
+
</div>
|
| 1373 |
+
<div class="field-hint">First image auto-sets width & height preserving aspect ratio.</div>
|
| 1374 |
</div>
|
| 1375 |
|
| 1376 |
+
<!-- Prompt -->
|
| 1377 |
+
<div class="field">
|
| 1378 |
+
<label class="field-label" for="prompt"><span class="field-label-dot"></span>Edit Prompt</label>
|
| 1379 |
+
<textarea id="prompt" placeholder="Describe the edit — e.g. 'Change the weather to stormy'"></textarea>
|
|
|
|
| 1380 |
</div>
|
| 1381 |
|
| 1382 |
+
<!-- Advanced -->
|
| 1383 |
+
<div class="field">
|
| 1384 |
+
<button class="advanced-toggle" id="advancedToggle" type="button">
|
| 1385 |
<span>Advanced Settings</span>
|
| 1386 |
+
<span class="chevron" id="chevron">▼</span>
|
| 1387 |
</button>
|
| 1388 |
+
<div class="advanced-body" id="advancedBody">
|
| 1389 |
<div class="adv-grid">
|
| 1390 |
+
<div class="slider-row">
|
| 1391 |
+
<div class="slider-label-row">
|
| 1392 |
+
<span>seed</span>
|
| 1393 |
+
<span class="slider-val" id="seedVal">0</span>
|
|
|
|
|
|
|
| 1394 |
</div>
|
| 1395 |
+
<input type="range" id="seed" min="0" max="{MAX_SEED}" step="1" value="0"
|
| 1396 |
+
oninput="document.getElementById('seedVal').textContent=this.value" />
|
| 1397 |
</div>
|
| 1398 |
+
<div class="slider-row">
|
| 1399 |
+
<div class="slider-label-row">
|
| 1400 |
+
<span>steps</span>
|
| 1401 |
+
<span class="slider-val" id="stepsVal">4</span>
|
|
|
|
|
|
|
| 1402 |
</div>
|
| 1403 |
+
<input type="range" id="steps" min="1" max="20" step="1" value="4"
|
| 1404 |
+
oninput="document.getElementById('stepsVal').textContent=this.value" />
|
| 1405 |
</div>
|
| 1406 |
+
<div class="slider-row">
|
| 1407 |
+
<div class="slider-label-row">
|
| 1408 |
+
<span>width</span>
|
| 1409 |
+
<span class="slider-val" id="widthVal">1024</span>
|
|
|
|
|
|
|
| 1410 |
</div>
|
| 1411 |
+
<input type="range" id="width" min="256" max="{MAX_IMAGE_SIZE}" step="8" value="1024"
|
| 1412 |
+
oninput="document.getElementById('widthVal').textContent=this.value" />
|
| 1413 |
</div>
|
| 1414 |
+
<div class="slider-row">
|
| 1415 |
+
<div class="slider-label-row">
|
| 1416 |
+
<span>height</span>
|
| 1417 |
+
<span class="slider-val" id="heightVal">1024</span>
|
|
|
|
|
|
|
| 1418 |
</div>
|
| 1419 |
+
<input type="range" id="height" min="256" max="{MAX_IMAGE_SIZE}" step="8" value="1024"
|
| 1420 |
+
oninput="document.getElementById('heightVal').textContent=this.value" />
|
| 1421 |
</div>
|
| 1422 |
+
<div class="slider-row">
|
| 1423 |
+
<div class="slider-label-row">
|
| 1424 |
+
<span>guidance</span>
|
| 1425 |
+
<span class="slider-val" id="guidanceVal">1.0</span>
|
|
|
|
|
|
|
| 1426 |
</div>
|
| 1427 |
+
<input type="range" id="guidance" min="0" max="10" step="0.1" value="1.0"
|
| 1428 |
+
oninput="document.getElementById('guidanceVal').textContent=parseFloat(this.value).toFixed(1)" />
|
| 1429 |
</div>
|
|
|
|
| 1430 |
</div>
|
| 1431 |
<div class="checkbox-row">
|
| 1432 |
+
<input type="checkbox" id="randomizeSeed" checked />
|
| 1433 |
<label for="randomizeSeed">Randomize seed on each run</label>
|
| 1434 |
</div>
|
| 1435 |
</div>
|
| 1436 |
</div>
|
| 1437 |
|
| 1438 |
+
<!-- Run -->
|
| 1439 |
+
<button class="run-btn" id="runBtn" type="button">
|
| 1440 |
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
|
| 1441 |
+
<polygon points="5 3 19 12 5 21 5 3"/>
|
| 1442 |
+
</svg>
|
| 1443 |
+
Run Comparison
|
| 1444 |
+
</button>
|
| 1445 |
|
| 1446 |
</div>
|
| 1447 |
</div>
|
|
|
|
| 1448 |
|
| 1449 |
+
<!-- RESULT PANEL -->
|
| 1450 |
+
<div class="result-panel">
|
| 1451 |
+
<div class="result-header">
|
| 1452 |
+
<span class="result-header-title">Comparison Slider</span>
|
| 1453 |
+
<div class="result-meta-row">
|
| 1454 |
+
<div class="meta-chip">standard vs <span>small</span> decoder</div>
|
| 1455 |
+
<div class="meta-chip" id="resultStatusChip">waiting</div>
|
| 1456 |
+
</div>
|
| 1457 |
+
</div>
|
| 1458 |
|
| 1459 |
+
<!-- stage -->
|
| 1460 |
+
<div class="slider-stage empty" id="sliderStage">
|
| 1461 |
|
| 1462 |
+
<!-- empty -->
|
| 1463 |
+
<div class="empty-state" id="emptyState">
|
| 1464 |
+
<div class="empty-icon">
|
| 1465 |
+
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
|
| 1466 |
+
<rect x="3" y="3" width="18" height="18" rx="2"/>
|
| 1467 |
+
<path d="M3 9h18M9 21V9"/>
|
| 1468 |
+
</svg>
|
| 1469 |
+
</div>
|
| 1470 |
+
<div class="empty-title">No comparison yet</div>
|
| 1471 |
+
<div class="empty-sub">Run the pipeline to compare both decoders side by side</div>
|
|
|
|
|
|
|
| 1472 |
</div>
|
|
|
|
| 1473 |
|
| 1474 |
+
<!-- compare widget -->
|
| 1475 |
+
<div class="compare-wrap" id="compareWrap">
|
| 1476 |
+
<!-- RIGHT image (small decoder, base layer) -->
|
| 1477 |
+
<img class="compare-img" id="imgSmall" alt="Small Decoder" />
|
| 1478 |
+
<span class="compare-label compare-label-right">Small Decoder</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1479 |
|
| 1480 |
+
<!-- LEFT image (standard, overlay) -->
|
| 1481 |
+
<div class="compare-overlay" id="compareOverlay">
|
| 1482 |
+
<img id="imgStandard" alt="Standard Decoder" />
|
| 1483 |
+
</div>
|
| 1484 |
+
<span class="compare-label compare-label-left" id="leftLabel">Standard Decoder</span>
|
| 1485 |
|
| 1486 |
+
<!-- drag handle -->
|
| 1487 |
+
<div class="compare-handle" id="compareHandle"></div>
|
| 1488 |
+
</div>
|
| 1489 |
|
| 1490 |
+
<!-- loader -->
|
| 1491 |
+
<div class="loader-overlay" id="loaderOverlay">
|
| 1492 |
+
<div class="loader-ring"></div>
|
| 1493 |
+
<div class="loader-text" id="loaderText">running both pipelines...</div>
|
| 1494 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1495 |
</div>
|
|
|
|
| 1496 |
|
| 1497 |
+
<!-- footer -->
|
| 1498 |
+
<div class="result-footer">
|
| 1499 |
+
<a class="dl-btn hidden" id="dlStandard" download="standard_decoder.png">
|
| 1500 |
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
|
| 1501 |
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/>
|
| 1502 |
+
</svg>
|
| 1503 |
+
Standard
|
| 1504 |
+
</a>
|
| 1505 |
+
<a class="dl-btn hidden" id="dlSmall" download="small_decoder.png">
|
| 1506 |
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
|
| 1507 |
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/>
|
| 1508 |
+
</svg>
|
| 1509 |
+
Small
|
| 1510 |
+
</a>
|
| 1511 |
+
<div class="seed-display">seed: <span id="usedSeed">—</span></div>
|
| 1512 |
+
</div>
|
| 1513 |
</div>
|
|
|
|
| 1514 |
</div>
|
|
|
|
| 1515 |
|
| 1516 |
+
<!-- EXAMPLES -->
|
| 1517 |
+
<div class="examples-panel" id="examplesSection">
|
| 1518 |
+
<div class="examples-header">
|
| 1519 |
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="var(--orange)" stroke-width="2.5">
|
| 1520 |
+
<rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/>
|
| 1521 |
+
<rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/>
|
| 1522 |
+
</svg>
|
| 1523 |
+
<span class="panel-header-title">Examples</span>
|
| 1524 |
+
</div>
|
| 1525 |
<div class="examples-grid" id="examplesGrid"></div>
|
| 1526 |
</div>
|
| 1527 |
+
|
| 1528 |
+
</div><!-- /app -->
|
| 1529 |
+
|
| 1530 |
+
<script>
|
| 1531 |
+
const examples = {examples_json};
|
| 1532 |
+
|
| 1533 |
+
/* ── state ── */
|
| 1534 |
+
const state = {{
|
| 1535 |
+
files: [],
|
| 1536 |
+
advancedOpen: false,
|
| 1537 |
+
stdUrl: null,
|
| 1538 |
+
smallUrl: null,
|
| 1539 |
+
}};
|
| 1540 |
+
|
| 1541 |
+
/* ── refs ── */
|
| 1542 |
+
const uploadZone = document.getElementById('uploadZone');
|
| 1543 |
+
const fileInput = document.getElementById('fileInput');
|
| 1544 |
+
const uploadPlaceholder= document.getElementById('uploadPlaceholder');
|
| 1545 |
+
const previewContainer = document.getElementById('previewContainer');
|
| 1546 |
+
const previewGrid = document.getElementById('previewGrid');
|
| 1547 |
+
const previewCount = document.getElementById('previewCount');
|
| 1548 |
+
const clearImagesBtn = document.getElementById('clearImagesBtn');
|
| 1549 |
+
|
| 1550 |
+
const promptEl = document.getElementById('prompt');
|
| 1551 |
+
const seedEl = document.getElementById('seed');
|
| 1552 |
+
const stepsEl = document.getElementById('steps');
|
| 1553 |
+
const widthEl = document.getElementById('width');
|
| 1554 |
+
const heightEl = document.getElementById('height');
|
| 1555 |
+
const guidanceEl = document.getElementById('guidance');
|
| 1556 |
+
const randomizeSeedEl = document.getElementById('randomizeSeed');
|
| 1557 |
+
|
| 1558 |
+
const advancedToggle = document.getElementById('advancedToggle');
|
| 1559 |
+
const advancedBody = document.getElementById('advancedBody');
|
| 1560 |
+
const chevron = document.getElementById('chevron');
|
| 1561 |
+
|
| 1562 |
+
const runBtn = document.getElementById('runBtn');
|
| 1563 |
+
|
| 1564 |
+
const sliderStage = document.getElementById('sliderStage');
|
| 1565 |
+
const emptyState = document.getElementById('emptyState');
|
| 1566 |
+
const compareWrap = document.getElementById('compareWrap');
|
| 1567 |
+
const imgSmall = document.getElementById('imgSmall');
|
| 1568 |
+
const imgStandard = document.getElementById('imgStandard');
|
| 1569 |
+
const compareOverlay = document.getElementById('compareOverlay');
|
| 1570 |
+
const compareHandle = document.getElementById('compareHandle');
|
| 1571 |
+
|
| 1572 |
+
const loaderOverlay = document.getElementById('loaderOverlay');
|
| 1573 |
+
const loaderText = document.getElementById('loaderText');
|
| 1574 |
+
const resultStatusChip = document.getElementById('resultStatusChip');
|
| 1575 |
+
|
| 1576 |
+
const dlStandard = document.getElementById('dlStandard');
|
| 1577 |
+
const dlSmall = document.getElementById('dlSmall');
|
| 1578 |
+
const usedSeed = document.getElementById('usedSeed');
|
| 1579 |
+
|
| 1580 |
+
const toastWrap = document.getElementById('toastWrap');
|
| 1581 |
+
const examplesGrid = document.getElementById('examplesGrid');
|
| 1582 |
+
|
| 1583 |
+
const statusDot = document.getElementById('statusDot');
|
| 1584 |
+
const statusText = document.getElementById('statusText');
|
| 1585 |
+
|
| 1586 |
+
/* ── toast ── */
|
| 1587 |
+
function toast(msg, type='info') {{
|
| 1588 |
+
const el = document.createElement('div');
|
| 1589 |
+
el.className = 'toast' + (type==='error' ? ' toast-error' : type==='success' ? ' toast-success' : '');
|
| 1590 |
+
el.innerHTML = `<span class="toast-msg">${{msg}}</span><button class="toast-close" onclick="this.parentElement.remove()">×</button>`;
|
| 1591 |
+
toastWrap.appendChild(el);
|
| 1592 |
+
setTimeout(() => el.remove(), 4500);
|
| 1593 |
+
}}
|
| 1594 |
+
|
| 1595 |
+
/* ── status ── */
|
| 1596 |
+
function setStatus(running) {{
|
| 1597 |
+
statusDot.className = 'status-dot' + (running ? ' running' : '');
|
| 1598 |
+
statusText.textContent = running ? 'running' : 'idle';
|
| 1599 |
+
resultStatusChip.textContent = running ? 'processing…' : (state.stdUrl ? 'done' : 'waiting');
|
| 1600 |
+
runBtn.disabled = running;
|
| 1601 |
+
runBtn.style.opacity = running ? '0.7' : '1';
|
| 1602 |
+
}}
|
| 1603 |
+
|
| 1604 |
+
/* ── advanced ── */
|
| 1605 |
+
advancedToggle.addEventListener('click', () => {{
|
| 1606 |
+
state.advancedOpen = !state.advancedOpen;
|
| 1607 |
+
advancedBody.classList.toggle('open', state.advancedOpen);
|
| 1608 |
+
chevron.classList.toggle('open', state.advancedOpen);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1609 |
}});
|
| 1610 |
+
|
| 1611 |
+
/* ── file handling ── */
|
| 1612 |
+
function addFiles(fileList) {{
|
| 1613 |
+
const valid = Array.from(fileList).filter(f => f.type.startsWith('image/'));
|
| 1614 |
+
if (!valid.length) {{ toast('Please upload valid image files.', 'error'); return; }}
|
| 1615 |
+
state.files = [...state.files, ...valid];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1616 |
renderPreviews();
|
| 1617 |
+
}}
|
| 1618 |
+
|
| 1619 |
+
function renderPreviews() {{
|
| 1620 |
+
previewGrid.innerHTML = '';
|
| 1621 |
+
if (!state.files.length) {{
|
| 1622 |
+
previewContainer.style.display = 'none';
|
| 1623 |
+
uploadPlaceholder.style.display = 'flex';
|
| 1624 |
+
return;
|
| 1625 |
+
}}
|
| 1626 |
+
previewContainer.style.display = 'block';
|
| 1627 |
+
uploadPlaceholder.style.display = 'none';
|
| 1628 |
+
previewCount.textContent = state.files.length + ' image' + (state.files.length > 1 ? 's' : '');
|
| 1629 |
+
|
| 1630 |
+
state.files.forEach((file, idx) => {{
|
| 1631 |
+
const wrap = document.createElement('div');
|
| 1632 |
+
wrap.className = 'thumb';
|
| 1633 |
+
wrap.draggable = true;
|
| 1634 |
+
|
| 1635 |
+
const img = document.createElement('img');
|
| 1636 |
+
img.src = URL.createObjectURL(file);
|
| 1637 |
+
img.alt = file.name;
|
| 1638 |
+
|
| 1639 |
+
const overlay = document.createElement('div');
|
| 1640 |
+
overlay.className = 'thumb-overlay';
|
| 1641 |
+
|
| 1642 |
+
const rm = document.createElement('button');
|
| 1643 |
+
rm.type = 'button';
|
| 1644 |
+
rm.className = 'thumb-remove';
|
| 1645 |
+
rm.innerHTML = '×';
|
| 1646 |
+
rm.title = 'Remove';
|
| 1647 |
+
rm.addEventListener('click', (e) => {{
|
| 1648 |
+
e.stopPropagation();
|
| 1649 |
+
state.files.splice(idx, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1650 |
renderPreviews();
|
| 1651 |
+
}});
|
| 1652 |
+
overlay.appendChild(rm);
|
| 1653 |
+
|
| 1654 |
+
const num = document.createElement('div');
|
| 1655 |
+
num.className = 'thumb-num';
|
| 1656 |
+
num.textContent = idx + 1;
|
| 1657 |
+
|
| 1658 |
+
wrap.appendChild(img);
|
| 1659 |
+
wrap.appendChild(overlay);
|
| 1660 |
+
wrap.appendChild(num);
|
| 1661 |
+
previewGrid.appendChild(wrap);
|
| 1662 |
}});
|
| 1663 |
|
| 1664 |
+
/* add-more tile */
|
| 1665 |
+
const addMore = document.createElement('div');
|
| 1666 |
+
addMore.className = 'upload-add-more';
|
| 1667 |
+
addMore.title = 'Add more images';
|
| 1668 |
+
addMore.innerHTML = '+';
|
| 1669 |
+
addMore.addEventListener('click', () => fileInput.click());
|
| 1670 |
+
previewGrid.appendChild(addMore);
|
| 1671 |
+
}}
|
| 1672 |
+
|
| 1673 |
+
uploadPlaceholder.addEventListener('click', () => fileInput.click());
|
| 1674 |
+
uploadZone.addEventListener('click', (e) => {{ if (e.target === uploadZone) fileInput.click(); }});
|
| 1675 |
+
fileInput.addEventListener('change', (e) => {{ addFiles(e.target.files); fileInput.value = ''; }});
|
| 1676 |
+
|
| 1677 |
+
uploadZone.addEventListener('dragover', (e) => {{ e.preventDefault(); uploadZone.classList.add('dragover'); }});
|
| 1678 |
+
uploadZone.addEventListener('dragleave', () => uploadZone.classList.remove('dragover'));
|
| 1679 |
+
uploadZone.addEventListener('drop', (e) => {{
|
| 1680 |
+
e.preventDefault();
|
| 1681 |
+
uploadZone.classList.remove('dragover');
|
| 1682 |
+
if (e.dataTransfer.files?.length) addFiles(e.dataTransfer.files);
|
| 1683 |
}});
|
|
|
|
| 1684 |
|
| 1685 |
+
clearImagesBtn.addEventListener('click', () => {{ state.files = []; renderPreviews(); }});
|
| 1686 |
+
|
| 1687 |
+
/* ── compare slider ── */
|
| 1688 |
+
let dragging = false;
|
| 1689 |
+
let sliderPct = 50;
|
| 1690 |
+
|
| 1691 |
+
function setSliderPct(pct) {{
|
| 1692 |
+
sliderPct = Math.max(0, Math.min(100, pct));
|
| 1693 |
+
compareHandle.style.left = sliderPct + '%';
|
| 1694 |
+
compareOverlay.style.width = sliderPct + '%';
|
| 1695 |
+
}}
|
| 1696 |
+
|
| 1697 |
+
compareHandle.addEventListener('mousedown', (e) => {{ dragging = true; e.preventDefault(); }});
|
| 1698 |
+
window.addEventListener('mousemove', (e) => {{
|
| 1699 |
+
if (!dragging) return;
|
| 1700 |
+
const rect = compareWrap.getBoundingClientRect();
|
| 1701 |
+
const pct = ((e.clientX - rect.left) / rect.width) * 100;
|
| 1702 |
+
setSliderPct(pct);
|
| 1703 |
+
}});
|
| 1704 |
+
window.addEventListener('mouseup', () => dragging = false);
|
| 1705 |
+
|
| 1706 |
+
compareHandle.addEventListener('touchstart', (e) => {{ dragging = true; }}, {{passive:true}});
|
| 1707 |
+
window.addEventListener('touchmove', (e) => {{
|
| 1708 |
+
if (!dragging) return;
|
| 1709 |
+
const touch = e.touches[0];
|
| 1710 |
+
const rect = compareWrap.getBoundingClientRect();
|
| 1711 |
+
const pct = ((touch.clientX - rect.left) / rect.width) * 100;
|
| 1712 |
+
setSliderPct(pct);
|
| 1713 |
+
}}, {{passive:true}});
|
| 1714 |
+
window.addEventListener('touchend', () => dragging = false);
|
| 1715 |
+
|
| 1716 |
+
/* ── show comparison ── */
|
| 1717 |
+
function showComparison(stdUrl, smallUrl) {{
|
| 1718 |
+
state.stdUrl = stdUrl;
|
| 1719 |
+
state.smallUrl = smallUrl;
|
| 1720 |
+
|
| 1721 |
+
imgStandard.onload = () => {{
|
| 1722 |
+
sliderStage.classList.remove('empty');
|
| 1723 |
+
emptyState.style.display = 'none';
|
| 1724 |
+
compareWrap.classList.add('visible');
|
| 1725 |
+
setSliderPct(50);
|
| 1726 |
+
}};
|
| 1727 |
+
|
| 1728 |
+
imgSmall.src = smallUrl + '?t=' + Date.now();
|
| 1729 |
+
imgStandard.src = stdUrl + '?t=' + Date.now();
|
| 1730 |
+
|
| 1731 |
+
dlStandard.href = stdUrl;
|
| 1732 |
+
dlStandard.classList.remove('hidden');
|
| 1733 |
+
dlSmall.href = smallUrl;
|
| 1734 |
+
dlSmall.classList.remove('hidden');
|
| 1735 |
+
}}
|
| 1736 |
+
|
| 1737 |
+
/* ── submit ── */
|
| 1738 |
+
async function submitRun() {{
|
| 1739 |
+
const prompt = promptEl.value.trim();
|
| 1740 |
+
if (!prompt) {{ toast('Please enter a prompt.', 'error'); return; }}
|
| 1741 |
+
|
| 1742 |
+
const fd = new FormData();
|
| 1743 |
+
fd.append('prompt', prompt);
|
| 1744 |
+
fd.append('seed', seedEl.value);
|
| 1745 |
+
fd.append('randomize_seed', String(randomizeSeedEl.checked));
|
| 1746 |
+
fd.append('width', widthEl.value);
|
| 1747 |
+
fd.append('height', heightEl.value);
|
| 1748 |
+
fd.append('steps', stepsEl.value);
|
| 1749 |
+
fd.append('guidance_scale', parseFloat(guidanceEl.value).toFixed(1));
|
| 1750 |
+
state.files.forEach(f => fd.append('images', f));
|
| 1751 |
+
|
| 1752 |
+
setStatus(true);
|
| 1753 |
+
loaderOverlay.classList.add('active');
|
| 1754 |
+
|
| 1755 |
+
try {{
|
| 1756 |
+
const res = await fetch('/api/compare', {{ method:'POST', body:fd }});
|
| 1757 |
+
const data = await res.json();
|
| 1758 |
+
|
| 1759 |
+
if (!res.ok || !data.success) throw new Error(data.error || 'Processing failed.');
|
| 1760 |
+
|
| 1761 |
+
showComparison(data.standard.image_url, data.small.image_url);
|
| 1762 |
+
usedSeed.textContent = String(data.seed);
|
| 1763 |
+
resultStatusChip.textContent = 'done';
|
| 1764 |
+
toast('Comparison ready!', 'success');
|
| 1765 |
+
}} catch(err) {{
|
| 1766 |
+
toast(err.message || 'Unexpected error.', 'error');
|
| 1767 |
+
}} finally {{
|
| 1768 |
+
setStatus(false);
|
| 1769 |
+
loaderOverlay.classList.remove('active');
|
| 1770 |
+
}}
|
| 1771 |
+
}}
|
| 1772 |
+
|
| 1773 |
+
runBtn.addEventListener('click', submitRun);
|
| 1774 |
+
promptEl.addEventListener('keydown', (e) => {{ if (e.ctrlKey && e.key==='Enter') submitRun(); }});
|
| 1775 |
+
|
| 1776 |
+
/* ── examples ── */
|
| 1777 |
+
async function fileFromUrl(url, name) {{
|
| 1778 |
+
const res = await fetch(url);
|
| 1779 |
+
if (!res.ok) throw new Error('Failed to fetch example image.');
|
| 1780 |
+
const blob = await res.blob();
|
| 1781 |
+
return new File([blob], name, {{ type: blob.type || 'image/jpeg' }});
|
| 1782 |
+
}}
|
| 1783 |
+
|
| 1784 |
+
function renderExamples() {{
|
| 1785 |
+
examplesGrid.innerHTML = '';
|
| 1786 |
+
examples.forEach(item => {{
|
| 1787 |
+
const card = document.createElement('div');
|
| 1788 |
+
card.className = 'example-card';
|
| 1789 |
+
|
| 1790 |
+
const imgWrap = document.createElement('div');
|
| 1791 |
+
imgWrap.className = 'example-img-wrap';
|
| 1792 |
+
const img = document.createElement('img');
|
| 1793 |
+
img.src = item.url;
|
| 1794 |
+
img.alt = item.file;
|
| 1795 |
+
img.loading = 'lazy';
|
| 1796 |
+
imgWrap.appendChild(img);
|
| 1797 |
+
|
| 1798 |
+
const body = document.createElement('div');
|
| 1799 |
+
body.className = 'example-card-body';
|
| 1800 |
+
|
| 1801 |
+
const p = document.createElement('p');
|
| 1802 |
+
p.className = 'example-prompt';
|
| 1803 |
+
p.textContent = item.prompt;
|
| 1804 |
+
|
| 1805 |
+
const btn = document.createElement('button');
|
| 1806 |
+
btn.type = 'button';
|
| 1807 |
+
btn.className = 'use-example-btn';
|
| 1808 |
+
btn.textContent = '↳ Use this example';
|
| 1809 |
+
btn.addEventListener('click', async (e) => {{
|
| 1810 |
+
e.stopPropagation();
|
| 1811 |
+
try {{
|
| 1812 |
+
btn.textContent = 'Loading…';
|
| 1813 |
+
btn.disabled = true;
|
| 1814 |
+
const file = await fileFromUrl(item.url, item.file);
|
| 1815 |
+
state.files = [file];
|
| 1816 |
+
renderPreviews();
|
| 1817 |
+
promptEl.value = item.prompt;
|
| 1818 |
+
toast('Example loaded.', 'success');
|
| 1819 |
+
}} catch(err) {{
|
| 1820 |
+
toast(err.message, 'error');
|
| 1821 |
+
}} finally {{
|
| 1822 |
+
btn.textContent = '↳ Use this example';
|
| 1823 |
+
btn.disabled = false;
|
| 1824 |
+
}}
|
| 1825 |
+
}});
|
| 1826 |
+
|
| 1827 |
+
body.appendChild(p);
|
| 1828 |
+
body.appendChild(btn);
|
| 1829 |
+
card.appendChild(imgWrap);
|
| 1830 |
+
card.appendChild(body);
|
| 1831 |
+
examplesGrid.appendChild(card);
|
| 1832 |
+
}});
|
| 1833 |
+
}}
|
| 1834 |
+
|
| 1835 |
+
/* ── init ── */
|
| 1836 |
+
setStatus(false);
|
| 1837 |
+
renderPreviews();
|
| 1838 |
+
renderExamples();
|
| 1839 |
+
</script>
|
| 1840 |
</body>
|
| 1841 |
</html>"""
|
| 1842 |
|
| 1843 |
|
| 1844 |
+
app.launch()
|