Spaces:
Running on Zero
Running on Zero
UI refinement: pill badges, settings in accordion, cleaner header/footer, tighter spacing
Browse files
app.py
CHANGED
|
@@ -297,12 +297,17 @@ def run_custom(prompt, neg, res, steps, cfg, shift, scheduler, sampler, ckpt, se
|
|
| 297 |
# UI
|
| 298 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 299 |
CSS = """
|
| 300 |
-
.status-box { min-height:
|
| 301 |
-
.model-badge {
|
| 302 |
-
|
|
|
|
|
|
|
|
|
|
| 303 |
.gallery-item img { border-radius: 8px; }
|
| 304 |
-
/*
|
| 305 |
-
.
|
|
|
|
|
|
|
| 306 |
"""
|
| 307 |
|
| 308 |
with gr.Blocks(title="Zeta-Chroma Test Bench", theme=gr.themes.Soft(), css=CSS, js="""function() {
|
|
@@ -325,14 +330,7 @@ with gr.Blocks(title="Zeta-Chroma Test Bench", theme=gr.themes.Soft(), css=CSS,
|
|
| 325 |
}""") as ui:
|
| 326 |
# ββ Header ββ
|
| 327 |
gr.Markdown("# \U0001f3a8 Zeta-Chroma Test Bench")
|
| 328 |
-
gr.
|
| 329 |
-
# Model badge β age is computed by JS injected via head param (Gradio SSR strips inline scripts)
|
| 330 |
-
|
| 331 |
-
gr.HTML(f'<span class="model-badge">\U0001f516 {FINETUNE_MODEL_ID} @ {MODEL_COMMIT_SHA}</span> '
|
| 332 |
-
|
| 333 |
-
f'<span class="model-badge" id="model-age" data-utc="{MODEL_FILE_DATE}">\u231b loaded {MODEL_FILE_AGE}</span> '
|
| 334 |
-
|
| 335 |
-
f'<span class="model-badge">\u26a0\ufe0f WIP Checkpoint</span>')
|
| 336 |
|
| 337 |
|
| 338 |
with gr.Tabs():
|
|
@@ -349,25 +347,23 @@ with gr.Blocks(title="Zeta-Chroma Test Bench", theme=gr.themes.Soft(), css=CSS,
|
|
| 349 |
# Gallery (the main content)
|
| 350 |
g = gr.Gallery(label="Results", columns=2, object_fit="contain", format="png", show_download_button=True, show_share_button=True, preview=True)
|
| 351 |
|
| 352 |
-
# Settings
|
| 353 |
-
with gr.
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
restore_prompts_btn = gr.Button("\U0001f504 Reset All Prompts", size="sm", variant="secondary")
|
| 368 |
|
| 369 |
# Editable prompts in grouped accordions
|
| 370 |
-
gr.Markdown("---")
|
| 371 |
gr.Markdown("#### \U0001f4dd Prompts *(editable \u2014 resets on refresh)*")
|
| 372 |
|
| 373 |
prompt_boxes = []
|
|
@@ -392,7 +388,9 @@ with gr.Blocks(title="Zeta-Chroma Test Bench", theme=gr.themes.Soft(), css=CSS,
|
|
| 392 |
tb = gr.Textbox(value=TEST_PROMPTS[i]["prompt"], label=TEST_PROMPTS[i]["name"], lines=2, show_copy_button=True)
|
| 393 |
prompt_boxes.append(tb)
|
| 394 |
|
| 395 |
-
|
|
|
|
|
|
|
| 396 |
|
| 397 |
# Wire events
|
| 398 |
suite_event = btn.click(fn=run_test_suite, inputs=[suite_seed, suite_steps, suite_cfg, suite_shift, suite_res, suite_neg, suite_sched, suite_sampler, suite_ckpt] + prompt_boxes, outputs=[g, st, log])
|
|
@@ -421,8 +419,9 @@ with gr.Blocks(title="Zeta-Chroma Test Bench", theme=gr.themes.Soft(), css=CSS,
|
|
| 421 |
c_sched = gr.Dropdown(label="Scheduler", choices=SCHEDULERS, value=DEFAULT_SCHEDULER)
|
| 422 |
|
| 423 |
|
| 424 |
-
|
| 425 |
-
|
|
|
|
| 426 |
|
| 427 |
# Example prompts
|
| 428 |
gr.Markdown("#### \U0001f4a1 Examples *(click to use)*")
|
|
@@ -434,9 +433,8 @@ with gr.Blocks(title="Zeta-Chroma Test Bench", theme=gr.themes.Soft(), css=CSS,
|
|
| 434 |
cb.click(fn=run_custom, inputs=[cp, cn, cr, cs, cc, csh, c_sched, c_sampler, c_ckpt, cse, csr], outputs=[ci, cso])
|
| 435 |
|
| 436 |
# Footer
|
| 437 |
-
|
| 438 |
-
gr.Markdown("---")
|
| 439 |
-
gr.Markdown(f"*[Zeta-Chroma](https://huggingface.co/lodestones/Zeta-Chroma) \u00b7 `{MODEL_COMMIT_SHA}` \u00b7 NextDiTPixelSpace \u00b7 Qwen3 \u00b7 Pixel-space (no VAE) \u00b7 [Source](https://huggingface.co/spaces/chipfoxx/zeta-chroma-test-bench)*")
|
| 440 |
|
| 441 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 442 |
# Webhook
|
|
|
|
| 297 |
# UI
|
| 298 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 299 |
CSS = """
|
| 300 |
+
.status-box { min-height: 60px; }
|
| 301 |
+
.model-badge {
|
| 302 |
+
display: inline-block; padding: 5px 12px; border-radius: 20px;
|
| 303 |
+
background: #1e293b; color: #94a3b8; font-size: 11px;
|
| 304 |
+
font-family: monospace; margin: 2px 4px 2px 0; border: 1px solid #334155;
|
| 305 |
+
}
|
| 306 |
.gallery-item img { border-radius: 8px; }
|
| 307 |
+
/* Tighter accordion spacing */
|
| 308 |
+
.accordion { margin-bottom: 4px !important; }
|
| 309 |
+
/* Settings group visual */
|
| 310 |
+
.settings-group { border-left: 3px solid #6366f1; padding-left: 12px; margin: 8px 0; }
|
| 311 |
"""
|
| 312 |
|
| 313 |
with gr.Blocks(title="Zeta-Chroma Test Bench", theme=gr.themes.Soft(), css=CSS, js="""function() {
|
|
|
|
| 330 |
}""") as ui:
|
| 331 |
# ββ Header ββ
|
| 332 |
gr.Markdown("# \U0001f3a8 Zeta-Chroma Test Bench")
|
| 333 |
+
gr.HTML(f'<div style="margin:-8px 0 12px 0;"><span class="model-badge">\U0001f516 {FINETUNE_MODEL_ID} @ {MODEL_COMMIT_SHA}</span><span class="model-badge" id="model-age" data-utc="{MODEL_FILE_DATE}">\u231b loaded {MODEL_FILE_AGE}</span><span class="model-badge">\u26a0\ufe0f WIP</span><span class="model-badge">\U0001f4e1 Pixel-space \u00b7 No VAE</span></div>')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
|
| 335 |
|
| 336 |
with gr.Tabs():
|
|
|
|
| 347 |
# Gallery (the main content)
|
| 348 |
g = gr.Gallery(label="Results", columns=2, object_fit="contain", format="png", show_download_button=True, show_share_button=True, preview=True)
|
| 349 |
|
| 350 |
+
# Settings in a collapsible section
|
| 351 |
+
with gr.Accordion("\u2699\ufe0f Settings", open=True):
|
| 352 |
+
with gr.Row(equal_height=True):
|
| 353 |
+
suite_seed = gr.Number(label="Seed", value=DEFAULT_SEED, precision=0)
|
| 354 |
+
suite_res = gr.Dropdown(label="Resolution", choices=RESOLUTIONS, value="1024\u00d71024")
|
| 355 |
+
suite_sampler = gr.Dropdown(label="Sampler", choices=SAMPLERS, value=DEFAULT_SAMPLER)
|
| 356 |
+
suite_sched = gr.Dropdown(label="Scheduler", choices=SCHEDULERS, value=DEFAULT_SCHEDULER)
|
| 357 |
+
with gr.Row(equal_height=True):
|
| 358 |
+
suite_steps = gr.Slider(label="Steps", minimum=10, maximum=100, value=DEFAULT_STEPS, step=1)
|
| 359 |
+
suite_cfg = gr.Slider(label="CFG", minimum=1.0, maximum=15.0, value=DEFAULT_CFG, step=0.1)
|
| 360 |
+
suite_shift = gr.Slider(label="Shift", minimum=1.0, maximum=15.0, value=DEFAULT_SHIFT, step=0.5)
|
| 361 |
+
suite_neg = gr.Textbox(label="Negative Prompt", value=DEFAULT_NEG, lines=1)
|
| 362 |
+
with gr.Row():
|
| 363 |
+
restore_settings_btn = gr.Button("\U0001f504 Reset Settings", size="sm", variant="secondary")
|
| 364 |
+
restore_prompts_btn = gr.Button("\U0001f504 Reset All Prompts", size="sm", variant="secondary")
|
|
|
|
| 365 |
|
| 366 |
# Editable prompts in grouped accordions
|
|
|
|
| 367 |
gr.Markdown("#### \U0001f4dd Prompts *(editable \u2014 resets on refresh)*")
|
| 368 |
|
| 369 |
prompt_boxes = []
|
|
|
|
| 388 |
tb = gr.Textbox(value=TEST_PROMPTS[i]["prompt"], label=TEST_PROMPTS[i]["name"], lines=2, show_copy_button=True)
|
| 389 |
prompt_boxes.append(tb)
|
| 390 |
|
| 391 |
+
|
| 392 |
+
with gr.Accordion("\U0001f4dc Run History", open=False):
|
| 393 |
+
log = gr.Textbox(value=format_log(), interactive=False, lines=3, show_label=False)
|
| 394 |
|
| 395 |
# Wire events
|
| 396 |
suite_event = btn.click(fn=run_test_suite, inputs=[suite_seed, suite_steps, suite_cfg, suite_shift, suite_res, suite_neg, suite_sched, suite_sampler, suite_ckpt] + prompt_boxes, outputs=[g, st, log])
|
|
|
|
| 419 |
c_sched = gr.Dropdown(label="Scheduler", choices=SCHEDULERS, value=DEFAULT_SCHEDULER)
|
| 420 |
|
| 421 |
|
| 422 |
+
with gr.Row():
|
| 423 |
+
cb = gr.Button("\U0001f3a8 Generate", variant="primary", size="lg", scale=3)
|
| 424 |
+
cso = gr.Textbox(label="Seed", interactive=False, scale=1)
|
| 425 |
|
| 426 |
# Example prompts
|
| 427 |
gr.Markdown("#### \U0001f4a1 Examples *(click to use)*")
|
|
|
|
| 433 |
cb.click(fn=run_custom, inputs=[cp, cn, cr, cs, cc, csh, c_sched, c_sampler, c_ckpt, cse, csr], outputs=[ci, cso])
|
| 434 |
|
| 435 |
# Footer
|
| 436 |
+
gr.HTML('<hr style="margin:24px 0 12px;border-color:#1e293b;">')
|
| 437 |
+
gr.Markdown(f"*[Zeta-Chroma](https://huggingface.co/lodestones/Zeta-Chroma) \u00b7 `{MODEL_COMMIT_SHA}` \u00b7 [Source Code](https://huggingface.co/spaces/chipfoxx/zeta-chroma-test-bench/tree/main)*")
|
|
|
|
| 438 |
|
| 439 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 440 |
# Webhook
|