tchung1970 Claude Opus 4.5 commited on
Commit
e3b7665
·
1 Parent(s): d46cb20

Match Z-Image UI exactly - blue pill labels and white output area

Browse files

- Added elem_classes="input-section" and "output-section" to columns
- Blue pill labels for Prompt and Aspect Ratio (background #0071e3)
- Dark theme input section (#1d1d1f background)
- White/light background (#f5f5f7) for image generation area inside output
- Proper dark mode styling throughout

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>

Files changed (1) hide show
  1. app.py +78 -34
app.py CHANGED
@@ -242,7 +242,7 @@ examples_images = [
242
  ["The person from image 1 is petting the cat from image 2, the bird from image 3 is next to them", ["woman1.webp", "cat_window.webp", "bird.webp"]]
243
  ]
244
 
245
- # Apple-inspired CSS styling (matching Z-Image)
246
  css = """
247
  /* Global Styles */
248
  .gradio-container {
@@ -274,46 +274,59 @@ css = """
274
 
275
  /* Input Section */
276
  .input-section {
277
- background: #ffffff;
278
- border-radius: 18px;
279
- padding: 32px;
280
- box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
281
- }
282
-
283
- #input-column {
284
- background: #ffffff !important;
285
  border-radius: 18px !important;
286
  padding: 32px !important;
287
- box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08) !important;
288
  width: 550px !important;
289
  min-width: 550px !important;
290
  max-width: 550px !important;
291
  flex: 0 0 550px !important;
292
  }
293
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  /* Textbox */
 
295
  #prompt-textbox textarea {
296
  font-size: 17px !important;
297
  line-height: 1.47 !important;
298
  border-radius: 12px !important;
299
- border: 1px solid #d2d2d7 !important;
300
  padding: 12px 16px !important;
301
- background: #ffffff !important;
 
302
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif !important;
303
  min-height: 500px !important;
304
  max-height: 700px !important;
305
  height: 500px !important;
306
  resize: vertical !important;
307
  overflow-y: auto !important;
308
- margin-bottom: 16px !important;
309
  }
310
 
 
311
  #prompt-textbox textarea:focus {
312
  border-color: #0071e3 !important;
313
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15) !important;
314
  outline: none !important;
315
  }
316
 
 
 
 
 
 
317
  /* Character counter */
318
  .char-counter {
319
  text-align: center;
@@ -331,6 +344,15 @@ css = """
331
  color: #ff3b30;
332
  }
333
 
 
 
 
 
 
 
 
 
 
334
  /* Button */
335
  button.primary {
336
  font-size: 17px !important;
@@ -352,11 +374,11 @@ button.primary:hover {
352
  }
353
 
354
  /* Output Section */
355
- #output-column {
356
- background: #ffffff !important;
357
  border-radius: 18px !important;
358
  padding: 32px !important;
359
- box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08) !important;
360
  overflow: hidden !important;
361
  display: flex !important;
362
  align-items: center !important;
@@ -364,36 +386,58 @@ button.primary:hover {
364
  min-height: 80vh !important;
365
  max-height: 90vh !important;
366
  flex: 1 1 auto !important;
 
 
 
 
 
 
 
 
367
  }
368
 
369
- #output-column img {
370
  border-radius: 12px !important;
371
  max-width: 100% !important;
372
  max-height: 85vh !important;
373
  width: auto !important;
374
  height: auto !important;
375
  object-fit: contain !important;
 
 
 
376
  }
377
 
378
- /* Dark Mode */
379
- .dark #input-column,
380
- .dark #output-column {
381
- background: #1d1d1f !important;
382
- box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4) !important;
 
 
 
 
 
383
  }
384
 
385
- .dark .main-title {
386
- color: #f5f5f7 !important;
 
 
 
 
 
 
387
  }
388
 
389
- .dark #prompt-textbox textarea {
390
- background: #1d1d1f !important;
391
- border-color: #424245 !important;
392
- color: #f5f5f7 !important;
393
  }
394
 
395
- .dark .char-counter {
396
- color: #a1a1a6 !important;
 
 
397
  }
398
 
399
  /* Layout - Force horizontal layout */
@@ -440,14 +484,14 @@ footer {
440
  flex-wrap: wrap !important;
441
  }
442
 
443
- #input-column {
444
  width: 100% !important;
445
  min-width: 100% !important;
446
  max-width: 100% !important;
447
  flex: 1 1 100% !important;
448
  }
449
 
450
- #output-column {
451
  width: 100% !important;
452
  min-height: 50vh !important;
453
  }
@@ -542,7 +586,7 @@ with gr.Blocks() as demo:
542
  with gr.Row(equal_height=False, elem_id="main-row"):
543
 
544
  # LEFT COLUMN - Input Controls
545
- with gr.Column(scale=0, min_width=550, elem_id="input-column"):
546
 
547
  # Header
548
  gr.HTML("""
@@ -595,7 +639,7 @@ with gr.Blocks() as demo:
595
  )
596
 
597
  # RIGHT COLUMN - Image Output
598
- with gr.Column(scale=2, elem_id="output-column"):
599
  result = gr.Image(
600
  label="Result",
601
  show_label=False,
 
242
  ["The person from image 1 is petting the cat from image 2, the bird from image 3 is next to them", ["woman1.webp", "cat_window.webp", "bird.webp"]]
243
  ]
244
 
245
+ # Apple-inspired CSS styling (matching Z-Image exactly)
246
  css = """
247
  /* Global Styles */
248
  .gradio-container {
 
274
 
275
  /* Input Section */
276
  .input-section {
277
+ background: #1d1d1f !important;
 
 
 
 
 
 
 
278
  border-radius: 18px !important;
279
  padding: 32px !important;
280
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4) !important;
281
  width: 550px !important;
282
  min-width: 550px !important;
283
  max-width: 550px !important;
284
  flex: 0 0 550px !important;
285
  }
286
 
287
+ /* Blue pill labels for Prompt and Aspect Ratio */
288
+ .input-section label span,
289
+ #prompt-textbox label span,
290
+ .input-section .label-wrap span {
291
+ background: #0071e3 !important;
292
+ color: #ffffff !important;
293
+ padding: 4px 12px !important;
294
+ border-radius: 980px !important;
295
+ font-size: 14px !important;
296
+ font-weight: 500 !important;
297
+ display: inline-block !important;
298
+ }
299
+
300
  /* Textbox */
301
+ .input-section textarea,
302
  #prompt-textbox textarea {
303
  font-size: 17px !important;
304
  line-height: 1.47 !important;
305
  border-radius: 12px !important;
306
+ border: 1px solid #424245 !important;
307
  padding: 12px 16px !important;
308
+ background: #2d2d2f !important;
309
+ color: #f5f5f7 !important;
310
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif !important;
311
  min-height: 500px !important;
312
  max-height: 700px !important;
313
  height: 500px !important;
314
  resize: vertical !important;
315
  overflow-y: auto !important;
 
316
  }
317
 
318
+ .input-section textarea:focus,
319
  #prompt-textbox textarea:focus {
320
  border-color: #0071e3 !important;
321
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15) !important;
322
  outline: none !important;
323
  }
324
 
325
+ .input-section textarea::placeholder,
326
+ #prompt-textbox textarea::placeholder {
327
+ color: #86868b !important;
328
+ }
329
+
330
  /* Character counter */
331
  .char-counter {
332
  text-align: center;
 
344
  color: #ff3b30;
345
  }
346
 
347
+ /* Dropdown styling */
348
+ .input-section select,
349
+ .input-section .wrap {
350
+ background: #2d2d2f !important;
351
+ border: 1px solid #424245 !important;
352
+ border-radius: 12px !important;
353
+ color: #f5f5f7 !important;
354
+ }
355
+
356
  /* Button */
357
  button.primary {
358
  font-size: 17px !important;
 
374
  }
375
 
376
  /* Output Section */
377
+ .output-section {
378
+ background: #1d1d1f !important;
379
  border-radius: 18px !important;
380
  padding: 32px !important;
381
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4) !important;
382
  overflow: hidden !important;
383
  display: flex !important;
384
  align-items: center !important;
 
386
  min-height: 80vh !important;
387
  max-height: 90vh !important;
388
  flex: 1 1 auto !important;
389
+ will-change: auto !important;
390
+ position: relative !important;
391
+ }
392
+
393
+ .output-section * {
394
+ transform: none !important;
395
+ transition: none !important;
396
+ animation: none !important;
397
  }
398
 
399
+ .output-section img {
400
  border-radius: 12px !important;
401
  max-width: 100% !important;
402
  max-height: 85vh !important;
403
  width: auto !important;
404
  height: auto !important;
405
  object-fit: contain !important;
406
+ transform: none !important;
407
+ backface-visibility: hidden !important;
408
+ -webkit-backface-visibility: hidden !important;
409
  }
410
 
411
+ /* Make progress/generation area fill more space */
412
+ .output-section > div {
413
+ width: 100% !important;
414
+ min-height: 75vh !important;
415
+ max-height: 85vh !important;
416
+ display: flex !important;
417
+ align-items: center !important;
418
+ justify-content: center !important;
419
+ background: #f5f5f7 !important;
420
+ border-radius: 12px !important;
421
  }
422
 
423
+ .output-section > div > div {
424
+ min-height: 75vh !important;
425
+ max-height: 85vh !important;
426
+ width: 100% !important;
427
+ display: flex !important;
428
+ align-items: center !important;
429
+ justify-content: center !important;
430
+ background: #f5f5f7 !important;
431
  }
432
 
433
+ .output-section * {
434
+ max-width: 100% !important;
 
 
435
  }
436
 
437
+ /* Dark Mode - title */
438
+ .dark .main-title,
439
+ .input-section .main-title {
440
+ color: #f5f5f7 !important;
441
  }
442
 
443
  /* Layout - Force horizontal layout */
 
484
  flex-wrap: wrap !important;
485
  }
486
 
487
+ .input-section {
488
  width: 100% !important;
489
  min-width: 100% !important;
490
  max-width: 100% !important;
491
  flex: 1 1 100% !important;
492
  }
493
 
494
+ .output-section {
495
  width: 100% !important;
496
  min-height: 50vh !important;
497
  }
 
586
  with gr.Row(equal_height=False, elem_id="main-row"):
587
 
588
  # LEFT COLUMN - Input Controls
589
+ with gr.Column(scale=0, min_width=550, elem_classes="input-section", elem_id="input-column"):
590
 
591
  # Header
592
  gr.HTML("""
 
639
  )
640
 
641
  # RIGHT COLUMN - Image Output
642
+ with gr.Column(scale=2, elem_classes="output-section", elem_id="output-column"):
643
  result = gr.Image(
644
  label="Result",
645
  show_label=False,