leoeric commited on
Commit
ff7da2f
Β·
1 Parent(s): 15008bf

Complete UI redesign with improved tabs, better organization, and enhanced visual design

Browse files
Files changed (1) hide show
  1. app.py +148 -58
app.py CHANGED
@@ -381,38 +381,78 @@ with gr.Blocks(
381
  </div>
382
  """)
383
 
384
- with gr.Tabs():
385
- with gr.Tab("Text-to-Image"):
386
  with gr.Row():
387
- with gr.Column():
388
- image_prompt = gr.Textbox(
389
- label="Prompt",
390
- placeholder="a film still of a cat playing piano",
391
- lines=3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
392
  )
393
- # Checkpoint upload hidden - using Model Hub instead
394
- image_checkpoint = gr.File(
395
- label="Model Checkpoint (.pth file) - Optional if already uploaded to Space",
396
- file_types=[".pth"],
397
- visible=False # Hidden - using Model Hub
 
398
  )
399
- image_config = gr.Textbox(
400
- label="Config Path",
401
- value="configs/starflow_3B_t2i_256x256.yaml",
402
- placeholder="configs/starflow_3B_t2i_256x256.yaml"
 
 
 
 
403
  )
404
- image_aspect = gr.Dropdown(
405
- choices=["1:1", "2:3", "3:2", "16:9", "9:16", "4:5", "5:4"],
406
- value="1:1",
407
- label="Aspect Ratio"
 
 
 
408
  )
409
- image_cfg = gr.Slider(1.0, 10.0, value=3.6, step=0.1, label="CFG Scale")
410
- image_seed = gr.Number(value=999, label="Seed", precision=0)
411
- image_btn = gr.Button("Generate Image", variant="primary")
412
-
413
- with gr.Column():
414
- image_output = gr.Image(label="Generated Image")
415
- image_status = gr.Textbox(label="Status", interactive=False)
416
 
417
  image_btn.click(
418
  fn=generate_image,
@@ -422,42 +462,92 @@ with gr.Blocks(
422
  queue=True # Use queue to handle long-running operations
423
  )
424
 
425
- with gr.Tab("Text-to-Video"):
426
  with gr.Row():
427
- with gr.Column():
428
- video_prompt = gr.Textbox(
429
- label="Prompt",
430
- placeholder="a corgi dog looks at the camera",
431
- lines=3
432
- )
433
- # Checkpoint upload hidden - using Model Hub instead
434
- video_checkpoint = gr.File(
435
- label="Model Checkpoint (.pth file) - Optional if already uploaded to Space",
436
- file_types=[".pth"],
437
- visible=False # Hidden - using Model Hub
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
438
  )
439
- video_config = gr.Textbox(
440
- label="Config Path",
441
- value="configs/starflow-v_7B_t2v_caus_480p.yaml",
442
- placeholder="configs/starflow-v_7B_t2v_caus_480p.yaml"
 
 
443
  )
444
- video_aspect = gr.Dropdown(
445
- choices=["16:9", "1:1", "4:3"],
446
- value="16:9",
447
- label="Aspect Ratio"
 
 
 
448
  )
449
- video_cfg = gr.Slider(1.0, 10.0, value=3.5, step=0.1, label="CFG Scale")
450
- video_seed = gr.Number(value=99, label="Seed", precision=0)
451
- video_length = gr.Slider(81, 481, value=81, step=80, label="Target Length (frames)")
452
- video_input_image = gr.File(
453
- label="Input Image (optional, for image-to-video)",
454
- file_types=["image"]
 
455
  )
456
- video_btn = gr.Button("Generate Video", variant="primary")
457
-
458
- with gr.Column():
459
- video_output = gr.Video(label="Generated Video")
460
- video_status = gr.Textbox(label="Status", interactive=False)
461
 
462
  video_btn.click(
463
  fn=generate_video,
 
381
  </div>
382
  """)
383
 
384
+ with gr.Tabs() as tabs:
385
+ with gr.Tab("πŸ–ΌοΈ Text-to-Image", id="image_tab"):
386
  with gr.Row():
387
+ with gr.Column(scale=1, min_width=400):
388
+ gr.Markdown("### βš™οΈ Generation Settings")
389
+ with gr.Group():
390
+ image_prompt = gr.Textbox(
391
+ label="πŸ“ Prompt",
392
+ placeholder="a film still of a cat playing piano",
393
+ lines=4,
394
+ info="Describe the image you want to generate"
395
+ )
396
+ image_config = gr.Textbox(
397
+ label="βš™οΈ Config Path",
398
+ value="configs/starflow_3B_t2i_256x256.yaml",
399
+ interactive=False,
400
+ info="Model configuration file"
401
+ )
402
+
403
+ with gr.Group():
404
+ gr.Markdown("#### 🎨 Image Settings")
405
+ image_aspect = gr.Dropdown(
406
+ label="Aspect Ratio",
407
+ choices=["1:1", "2:3", "3:2", "16:9", "9:16", "4:5", "5:4"],
408
+ value="1:1",
409
+ info="Image dimensions ratio"
410
+ )
411
+ image_cfg = gr.Slider(
412
+ label="CFG Scale",
413
+ minimum=1.0,
414
+ maximum=10.0,
415
+ value=3.6,
416
+ step=0.1,
417
+ info="Classifier-free guidance scale (higher = more prompt adherence)"
418
+ )
419
+ image_seed = gr.Number(
420
+ value=999,
421
+ label="🎲 Seed",
422
+ precision=0,
423
+ info="Random seed for reproducibility"
424
+ )
425
+
426
+ # Hidden checkpoint field
427
+ image_checkpoint = gr.Textbox(
428
+ label="Model Checkpoint Path (auto-downloaded)",
429
+ value=DEFAULT_IMAGE_CHECKPOINT,
430
+ visible=False
431
  )
432
+
433
+ image_btn = gr.Button(
434
+ "✨ Generate Image",
435
+ variant="primary",
436
+ size="lg",
437
+ elem_classes="generate-btn"
438
  )
439
+
440
+ with gr.Column(scale=1, min_width=500):
441
+ gr.Markdown("### 🎨 Generated Image")
442
+ image_output = gr.Image(
443
+ label="",
444
+ type="filepath",
445
+ height=500,
446
+ show_label=False
447
  )
448
+ image_status = gr.Textbox(
449
+ label="πŸ“Š Status",
450
+ lines=12,
451
+ max_lines=20,
452
+ interactive=False,
453
+ elem_classes="status-box",
454
+ placeholder="Status messages will appear here..."
455
  )
 
 
 
 
 
 
 
456
 
457
  image_btn.click(
458
  fn=generate_image,
 
462
  queue=True # Use queue to handle long-running operations
463
  )
464
 
465
+ with gr.Tab("🎬 Text-to-Video", id="video_tab"):
466
  with gr.Row():
467
+ with gr.Column(scale=1, min_width=400):
468
+ gr.Markdown("### βš™οΈ Generation Settings")
469
+ with gr.Group():
470
+ video_prompt = gr.Textbox(
471
+ label="πŸ“ Prompt",
472
+ placeholder="a corgi dog looks at the camera",
473
+ lines=4,
474
+ info="Describe the video you want to generate"
475
+ )
476
+ video_config = gr.Textbox(
477
+ label="βš™οΈ Config Path",
478
+ value="configs/starflow-v_7B_t2v_caus_480p.yaml",
479
+ interactive=False,
480
+ info="Model configuration file"
481
+ )
482
+
483
+ with gr.Group():
484
+ gr.Markdown("#### 🎬 Video Settings")
485
+ video_aspect = gr.Dropdown(
486
+ label="Aspect Ratio",
487
+ choices=["16:9", "1:1", "4:3"],
488
+ value="16:9",
489
+ info="Video dimensions ratio"
490
+ )
491
+ video_cfg = gr.Slider(
492
+ label="CFG Scale",
493
+ minimum=1.0,
494
+ maximum=10.0,
495
+ value=3.5,
496
+ step=0.1,
497
+ info="Classifier-free guidance scale"
498
+ )
499
+ video_seed = gr.Number(
500
+ value=99,
501
+ label="🎲 Seed",
502
+ precision=0,
503
+ info="Random seed for reproducibility"
504
+ )
505
+ video_length = gr.Slider(
506
+ label="Target Length (frames)",
507
+ minimum=81,
508
+ maximum=481,
509
+ value=81,
510
+ step=80,
511
+ info="Number of frames in the generated video"
512
+ )
513
+
514
+ with gr.Group():
515
+ gr.Markdown("#### πŸ–ΌοΈ Optional Input")
516
+ video_input_image = gr.Image(
517
+ label="Input Image (optional)",
518
+ type="filepath",
519
+ info="Provide an initial image for video generation"
520
+ )
521
+
522
+ # Hidden checkpoint field
523
+ video_checkpoint = gr.Textbox(
524
+ label="Model Checkpoint Path (auto-downloaded)",
525
+ value=DEFAULT_VIDEO_CHECKPOINT,
526
+ visible=False
527
  )
528
+
529
+ video_btn = gr.Button(
530
+ "✨ Generate Video",
531
+ variant="primary",
532
+ size="lg",
533
+ elem_classes="generate-btn"
534
  )
535
+
536
+ with gr.Column(scale=1, min_width=500):
537
+ gr.Markdown("### 🎬 Generated Video")
538
+ video_output = gr.Video(
539
+ label="",
540
+ height=500,
541
+ show_label=False
542
  )
543
+ video_status = gr.Textbox(
544
+ label="πŸ“Š Status",
545
+ lines=12,
546
+ max_lines=20,
547
+ interactive=False,
548
+ elem_classes="status-box",
549
+ placeholder="Status messages will appear here..."
550
  )
 
 
 
 
 
551
 
552
  video_btn.click(
553
  fn=generate_video,