atunc29 commited on
Commit
386ce83
·
verified ·
1 Parent(s): d080a39

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +76 -94
app.py CHANGED
@@ -549,75 +549,56 @@ def make_custom_css():
549
  font-weight: 800;
550
  text-shadow: 1px 2px 2px rgba(0,0,0,0.2);
551
  }
552
- .container {
553
  display: flex;
554
  gap: 20px;
 
555
  }
556
  .settings-panel {
557
- flex: 0 0 350px;
558
  background: #ffffff;
559
- padding: 20px;
560
  border-radius: 15px;
561
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
562
  }
563
- .settings-panel h3 {
564
- color: #2d7eeb;
565
- margin-bottom: 20px;
566
- font-size: 1.3rem;
567
- border-bottom: 2px solid #4b9ffa;
568
- padding-bottom: 10px;
569
- }
570
  .main-panel {
571
  flex: 1;
572
  background: #ffffff;
573
  padding: 20px;
574
  border-radius: 15px;
575
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
 
 
 
576
  }
577
- .gr-form {
578
- border: none !important;
579
- background: transparent !important;
580
- }
581
- .gr-box {
582
- border: 1px solid #e0e0f0 !important;
583
- background: #f8f9fe !important;
584
- border-radius: 10px !important;
585
- margin-bottom: 15px !important;
586
- transition: all 0.3s ease;
587
- }
588
- .gr-box:hover {
589
- border-color: #4b9ffa !important;
590
- box-shadow: 0 2px 8px rgba(75, 159, 250, 0.1) !important;
591
- }
592
- .gr-input, .gr-button {
593
- border-radius: 8px !important;
594
- transition: all 0.3s ease !important;
595
- }
596
- .gr-button {
597
- min-height: 45px !important;
598
- font-weight: 600 !important;
599
- text-transform: uppercase !important;
600
- letter-spacing: 0.5px !important;
601
- }
602
- .gr-button:hover {
603
- transform: translateY(-1px) !important;
604
  }
605
- .gr-button.primary-btn {
606
- background: #4b9ffa !important;
607
- color: white !important;
608
- border: none !important;
 
 
609
  }
610
- .gr-button.secondary-btn {
611
- background: #ff4d4d !important;
612
- color: white !important;
613
- border: none !important;
614
  }
615
- .progress-container {
616
- margin-top: 20px;
617
- padding: 15px;
618
  background: #f8f9fe;
619
  border-radius: 10px;
620
  }
 
 
 
 
 
621
  """
622
  return base_progress_css + extra_css
623
 
@@ -632,39 +613,26 @@ with block:
632
  Just upload an image, write a prompt, and watch the magic happen!"""
633
  )
634
 
635
- with gr.Row(elem_classes="container"):
 
636
  with gr.Column(elem_classes="settings-panel"):
637
- gr.Markdown("### Settings")
638
 
639
- # Basic Settings
640
  with gr.Group():
641
- input_image = gr.Image(
642
- label="Upload Image",
643
- type="numpy",
644
- height=320
645
- )
646
- prompt = gr.Textbox(
647
- label="Describe the animation you want",
648
- placeholder="E.g., The character dances gracefully with flowing movements...",
649
- lines=3
650
- )
651
  total_second_length = gr.Slider(
652
- label="Video Length (Seconds)",
653
  minimum=1,
654
  maximum=60,
655
  value=2,
656
  step=0.1
657
  )
658
-
659
- # Advanced Settings
660
- with gr.Group():
661
  steps = gr.Slider(
662
- label="Generation Steps",
663
  minimum=1,
664
  maximum=100,
665
  value=25,
666
  step=1,
667
- info='Higher values = better quality but slower'
668
  )
669
  gs = gr.Slider(
670
  label="Animation Strength",
@@ -672,34 +640,33 @@ with block:
672
  maximum=32.0,
673
  value=10.0,
674
  step=0.1,
675
- info='Controls how closely the animation follows the prompt'
676
  )
 
 
 
 
 
 
 
 
 
 
677
  use_teacache = gr.Checkbox(
678
  label='Fast Mode',
679
  value=True,
680
- info='Faster generation but may affect quality of fine details'
681
  )
682
  gpu_memory_preservation = gr.Slider(
683
  label="VRAM Usage",
684
  minimum=6,
685
  maximum=128,
686
  value=6,
687
- step=0.1,
688
- info="Increase if you get out of memory errors"
689
- )
690
- mp4_crf = gr.Slider(
691
- label="Video Quality",
692
- minimum=0,
693
- maximum=51,
694
- value=16,
695
- step=1,
696
- info="Lower value = higher quality (0-51)"
697
  )
698
  seed = gr.Number(
699
  label="Seed",
700
  value=31337,
701
- precision=0,
702
- info="Change for different results"
703
  )
704
 
705
  # Hidden settings
@@ -708,7 +675,31 @@ with block:
708
  cfg = gr.Slider(visible=False, value=1.0)
709
  rs = gr.Slider(visible=False, value=0.0)
710
 
711
- with gr.Row():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
712
  start_button = gr.Button(
713
  value="▶️ Generate Animation",
714
  elem_classes=["primary-btn"]
@@ -719,7 +710,8 @@ with block:
719
  interactive=False
720
  )
721
 
722
- with gr.Column(elem_classes="main-panel"):
 
723
  preview_image = gr.Image(
724
  label="Generation Preview",
725
  height=200,
@@ -729,7 +721,7 @@ with block:
729
  label="Generated Animation",
730
  autoplay=True,
731
  show_share_button=True,
732
- height=512,
733
  loop=True
734
  )
735
  with gr.Group(elem_classes="progress-container"):
@@ -740,16 +732,6 @@ with block:
740
  elem_classes='no-generating-animation'
741
  )
742
 
743
- # Quick Prompts Section
744
- with gr.Group():
745
- gr.Markdown("### 💡 Quick Prompt Ideas")
746
- example_quick_prompts = gr.Dataset(
747
- samples=quick_prompts,
748
- label='Click any prompt to try it',
749
- samples_per_page=5,
750
- components=[prompt]
751
- )
752
-
753
  # Setup callbacks
754
  ips = [
755
  input_image, prompt, n_prompt, seed,
 
549
  font-weight: 800;
550
  text-shadow: 1px 2px 2px rgba(0,0,0,0.2);
551
  }
552
+ .three-column-container {
553
  display: flex;
554
  gap: 20px;
555
+ min-height: 800px;
556
  }
557
  .settings-panel {
558
+ flex: 0 0 280px;
559
  background: #ffffff;
560
+ padding: 15px;
561
  border-radius: 15px;
562
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
563
  }
 
 
 
 
 
 
 
564
  .main-panel {
565
  flex: 1;
566
  background: #ffffff;
567
  padding: 20px;
568
  border-radius: 15px;
569
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
570
+ display: flex;
571
+ flex-direction: column;
572
+ gap: 20px;
573
  }
574
+ .output-panel {
575
+ flex: 0 0 400px;
576
+ background: #ffffff;
577
+ padding: 20px;
578
+ border-radius: 15px;
579
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
580
  }
581
+ .settings-panel h3 {
582
+ color: #2d7eeb;
583
+ margin-bottom: 15px;
584
+ font-size: 1.1rem;
585
+ border-bottom: 2px solid #4b9ffa;
586
+ padding-bottom: 8px;
587
  }
588
+ .prompt-container {
589
+ min-height: 200px;
 
 
590
  }
591
+ .quick-prompts {
592
+ margin-top: 10px;
593
+ padding: 10px;
594
  background: #f8f9fe;
595
  border-radius: 10px;
596
  }
597
+ .button-container {
598
+ display: flex;
599
+ gap: 10px;
600
+ margin-top: 15px;
601
+ }
602
  """
603
  return base_progress_css + extra_css
604
 
 
613
  Just upload an image, write a prompt, and watch the magic happen!"""
614
  )
615
 
616
+ with gr.Row(elem_classes="three-column-container"):
617
+ # Left Column - Settings
618
  with gr.Column(elem_classes="settings-panel"):
619
+ gr.Markdown("### Generation Settings")
620
 
 
621
  with gr.Group():
 
 
 
 
 
 
 
 
 
 
622
  total_second_length = gr.Slider(
623
+ label="Duration (Seconds)",
624
  minimum=1,
625
  maximum=60,
626
  value=2,
627
  step=0.1
628
  )
 
 
 
629
  steps = gr.Slider(
630
+ label="Quality Steps",
631
  minimum=1,
632
  maximum=100,
633
  value=25,
634
  step=1,
635
+ info='Higher = better quality'
636
  )
637
  gs = gr.Slider(
638
  label="Animation Strength",
 
640
  maximum=32.0,
641
  value=10.0,
642
  step=0.1,
 
643
  )
644
+ mp4_crf = gr.Slider(
645
+ label="Video Quality",
646
+ minimum=0,
647
+ maximum=51,
648
+ value=16,
649
+ step=1,
650
+ )
651
+
652
+ gr.Markdown("### Advanced")
653
+ with gr.Group():
654
  use_teacache = gr.Checkbox(
655
  label='Fast Mode',
656
  value=True,
657
+ info='Faster but may affect details'
658
  )
659
  gpu_memory_preservation = gr.Slider(
660
  label="VRAM Usage",
661
  minimum=6,
662
  maximum=128,
663
  value=6,
664
+ step=1
 
 
 
 
 
 
 
 
 
665
  )
666
  seed = gr.Number(
667
  label="Seed",
668
  value=31337,
669
+ precision=0
 
670
  )
671
 
672
  # Hidden settings
 
675
  cfg = gr.Slider(visible=False, value=1.0)
676
  rs = gr.Slider(visible=False, value=0.0)
677
 
678
+ # Middle Column - Main Content
679
+ with gr.Column(elem_classes="main-panel"):
680
+ input_image = gr.Image(
681
+ label="Upload Your Image",
682
+ type="numpy",
683
+ height=320
684
+ )
685
+
686
+ with gr.Group(elem_classes="prompt-container"):
687
+ prompt = gr.Textbox(
688
+ label="Describe the animation you want",
689
+ placeholder="E.g., The character dances gracefully with flowing movements...",
690
+ lines=4
691
+ )
692
+
693
+ with gr.Group(elem_classes="quick-prompts"):
694
+ gr.Markdown("### 💡 Quick Prompts")
695
+ example_quick_prompts = gr.Dataset(
696
+ samples=quick_prompts,
697
+ label='Click to use',
698
+ samples_per_page=3,
699
+ components=[prompt]
700
+ )
701
+
702
+ with gr.Group(elem_classes="button-container"):
703
  start_button = gr.Button(
704
  value="▶️ Generate Animation",
705
  elem_classes=["primary-btn"]
 
710
  interactive=False
711
  )
712
 
713
+ # Right Column - Output
714
+ with gr.Column(elem_classes="output-panel"):
715
  preview_image = gr.Image(
716
  label="Generation Preview",
717
  height=200,
 
721
  label="Generated Animation",
722
  autoplay=True,
723
  show_share_button=True,
724
+ height=400,
725
  loop=True
726
  )
727
  with gr.Group(elem_classes="progress-container"):
 
732
  elem_classes='no-generating-animation'
733
  )
734
 
 
 
 
 
 
 
 
 
 
 
735
  # Setup callbacks
736
  ips = [
737
  input_image, prompt, n_prompt, seed,