Spaces:
Running
on
Zero
Running
on
Zero
Complete UI redesign with improved tabs, better organization, and enhanced visual design
Browse files
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 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
)
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
|
|
|
| 398 |
)
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 403 |
)
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
|
|
|
|
|
|
|
|
|
| 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 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 438 |
)
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
|
|
|
|
|
|
| 443 |
)
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
|
|
|
|
|
|
|
|
|
| 448 |
)
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
|
|
|
| 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,
|