openfree commited on
Commit
5b811b4
·
verified ·
1 Parent(s): 7a73a44

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +144 -101
app.py CHANGED
@@ -560,26 +560,107 @@ custom_theme = gr.themes.Base(
560
  )
561
 
562
  css = '''
563
- #gen_btn{height: 100%}
564
- #title{text-align: center}
565
- #title h1{font-size: 3em; display:inline-flex; align-items:center}
566
- #title img{width: 100px; margin-right: 0.25em}
567
- #lora_list{background: var(--block-background-fill);padding: 0 1em .3em; font-size: 90%}
568
- .custom_lora_card{margin-bottom: 1em}
569
- .card_internal{display: flex;height: 100px;margin-top: .5em}
570
- .card_internal img{margin-right: 1em}
571
- .styler{--form-gap-width: 0px !important}
572
- #progress{height:30px}
573
- #progress .generating{display:none}
574
- .progress-container {width: 100%;height: 30px;background-color: #f0f0f0;border-radius: 15px;overflow: hidden;margin-bottom: 20px}
575
- .progress-bar {height: 100%;background-color: #4f46e5;width: calc(var(--current) / var(--total) * 100%);transition: width 0.5s ease-in-out}
576
- #component-8, .button_total{height: 100%; align-self: stretch;}
577
- #loaded_loras [data-testid="block-info"]{font-size:80%}
578
- #custom_lora_structure{background: var(--block-background-fill)}
579
- #custom_lora_btn{margin-top: auto;margin-bottom: 11px}
580
- #random_btn{font-size: 300%}
581
- #component-11{align-self: stretch;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
582
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
583
  #lora_gallery {
584
  margin: 20px 0;
585
  padding: 10px;
@@ -592,7 +673,7 @@ css = '''
592
  display: block !important;
593
  }
594
 
595
- /* 갤러리 그리드 컨테이너 */
596
  #gallery {
597
  display: grid !important;
598
  grid-template-columns: repeat(10, 1fr) !important;
@@ -604,7 +685,7 @@ css = '''
604
  max-width: 100% !important;
605
  }
606
 
607
- /* 갤러리 아이템 */
608
  .gallery-item {
609
  position: relative !important;
610
  width: 100% !important;
@@ -616,7 +697,6 @@ css = '''
616
  overflow: hidden;
617
  }
618
 
619
- /* 갤러리 이미지 */
620
  .gallery-item img {
621
  width: 100% !important;
622
  height: 100% !important;
@@ -627,13 +707,13 @@ css = '''
627
  /* 갤러리 그리드 래퍼 */
628
  .wrap, .svelte-w6dy5e {
629
  display: grid !important;
630
- grid-template-columns: repeat(10, 1fr) !important; /* 10개로 통일 */
631
  gap: 10px !important;
632
  width: 100% !important;
633
  max-width: 100% !important;
634
  }
635
 
636
- /* 모든 컨테이너 공통 설정 */
637
  .container, .content, .block, .contain {
638
  width: 100% !important;
639
  max-width: 100% !important;
@@ -641,14 +721,13 @@ css = '''
641
  padding: 0 !important;
642
  }
643
 
644
- /* 행 설정 */
645
  .row {
646
  width: 100% !important;
647
  margin: 0 !important;
648
  padding: 0 !important;
649
  }
650
 
651
- /* 입체감 있는 버튼 */
652
  .button_total {
653
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
654
  transition: all 0.3s ease;
@@ -659,7 +738,7 @@ css = '''
659
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
660
  }
661
 
662
- /* 입체감 있는 입력 필드 */
663
  input, textarea {
664
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
665
  transition: all 0.3s ease;
@@ -669,14 +748,14 @@ input:focus, textarea:focus {
669
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
670
  }
671
 
672
- /* 컴포넌트들의 border-radius 설정 */
673
  .gradio-container .input,
674
  .gradio-container .button,
675
  .gradio-container .block {
676
  border-radius: 12px;
677
  }
678
 
679
- /* 갤러리 스크롤바 스타일링 */
680
  #gallery::-webkit-scrollbar {
681
  width: 8px;
682
  }
@@ -695,96 +774,56 @@ input:focus, textarea:focus {
695
  background: #555;
696
  }
697
 
698
- /* 갤러리 flex 컨테이너 */
699
  .flex {
700
  width: 100% !important;
701
  max-width: 100% !important;
702
  display: flex !important;
703
  }
704
 
705
- /* svelte 특정 클래스 */
706
  .svelte-1p9xokt {
707
  width: 100% !important;
708
  max-width: 100% !important;
709
  }
710
 
711
- #footer {visibility: hidden;}
712
-
713
- /* 갤러리 컨테이너 클래스 */
714
- .gallery-container {
715
- width: 100% !important;
716
- max-width: 100% !important;
717
- }
718
-
719
- /* 생성된 이미지 결과 박스 크기 조정 (10% 축소) */
720
- .generated-image {
721
- width: 90% !important; /* 100%에서 90%로 축소 */
722
- max-width: 90% !important;
723
- margin: 0 auto !important; /* 중앙 정렬을 위해 */
724
- }
725
-
726
- /* 결과 이미지 컨테이너 크기 조정 */
727
- .result-container {
728
- width: 90% !important;
729
- max-width: 90% !important;
730
- margin: 0 auto !important;
731
  }
732
 
733
- /* Progress bar 크기 조정 */
734
- #progress {
735
- width: 90% !important;
 
 
 
736
  margin: 0 auto !important;
737
  }
738
 
739
- /* History gallery 크기 조정 */
740
- .history-gallery {
 
 
741
  width: 90% !important;
742
- max-width: 90% !important;
743
  margin: 0 auto !important;
744
  }
745
 
746
- /* 결과 이미지와 히스토리 갤러리 크기 조절 */
747
- .generated-image {
748
- width: 90% !important;
749
  margin: 0 auto !important;
 
 
750
  }
751
 
 
752
  .history-gallery {
 
 
753
  width: 90% !important;
 
754
  margin: 0 auto !important;
755
  }
756
-
757
- /* 결과 이미지 컨테이너 스타일링 */
758
- .generated-image > div {
759
- width: 90% !important;
760
- margin: 0 auto !important;
761
- }
762
-
763
- /* 히스토리 갤러리 컨테이너 스타일링 */
764
- .history-gallery > div {
765
- width: 90% !important;
766
- margin: 0 auto !important;
767
- }
768
-
769
- #result_column {
770
- display: flex;
771
- flex-direction: column;
772
- align-items: center; /* 가운데 정렬 */
773
- /* align-items: flex-start; /* 좌측 정렬을 원할 경우 이 줄을 사용 */
774
- width: 100%;
775
- }
776
-
777
- #result_image {
778
- max-width: 768px; /* 이미지 최대 너비 설정 */
779
- margin: 0 auto; /* 가운데 정렬을 위한 마진 */
780
- }
781
-
782
- .generated-image {
783
- display: flex;
784
- justify-content: center; /* 가운데 정렬 */
785
- /* justify-content: flex-start; /* 좌측 정렬을 원할 경우 이 줄을 사용 */
786
- width: 100%;
787
- }
788
  '''
789
 
790
  with gr.Blocks(theme=custom_theme, css=css, delete_cache=(60, 3600)) as app:
@@ -864,16 +903,19 @@ with gr.Blocks(theme=custom_theme, css=css, delete_cache=(60, 3600)) as app:
864
  with gr.Row():
865
  remove_button_3 = gr.Button("Remove", size="sm")
866
 
867
- # Result and Progress Area
868
- with gr.Column(elem_id="result_column"): # elem_id 추가
 
869
  progress_bar = gr.Markdown(elem_id="progress", visible=False)
870
- result = gr.Image(
871
- label="Generated Image",
872
- interactive=False,
873
- elem_classes=["generated-image"],
874
- container=True,
875
- elem_id="result_image" # elem_id 추가
876
- )
 
 
877
  with gr.Accordion("History", open=False):
878
  history_gallery = gr.Gallery(
879
  label="History",
@@ -885,6 +927,7 @@ with gr.Blocks(theme=custom_theme, css=css, delete_cache=(60, 3600)) as app:
885
 
886
 
887
 
 
888
  # Advanced Settings
889
  with gr.Row():
890
  with gr.Accordion("Advanced Settings", open=False):
 
560
  )
561
 
562
  css = '''
563
+ /* 기본 버튼 및 컴포넌트 스타일 */
564
+ #gen_btn {
565
+ height: 100%
566
+ }
567
+
568
+ #title {
569
+ text-align: center
570
+ }
571
+
572
+ #title h1 {
573
+ font-size: 3em;
574
+ display: inline-flex;
575
+ align-items: center
576
+ }
577
+
578
+ #title img {
579
+ width: 100px;
580
+ margin-right: 0.25em
581
+ }
582
+
583
+ #lora_list {
584
+ background: var(--block-background-fill);
585
+ padding: 0 1em .3em;
586
+ font-size: 90%
587
+ }
588
+
589
+ /* 커스텀 LoRA 카드 스타일 */
590
+ .custom_lora_card {
591
+ margin-bottom: 1em
592
+ }
593
+
594
+ .card_internal {
595
+ display: flex;
596
+ height: 100px;
597
+ margin-top: .5em
598
+ }
599
+
600
+ .card_internal img {
601
+ margin-right: 1em
602
+ }
603
+
604
+ /* 유틸리티 클래스 */
605
+ .styler {
606
+ --form-gap-width: 0px !important
607
+ }
608
+
609
+ /* 프로그레스 바 스타일 */
610
+ #progress {
611
+ height: 30px;
612
+ width: 90% !important;
613
+ margin: 0 auto !important;
614
+ }
615
 
616
+ #progress .generating {
617
+ display: none
618
+ }
619
+
620
+ .progress-container {
621
+ width: 100%;
622
+ height: 30px;
623
+ background-color: #f0f0f0;
624
+ border-radius: 15px;
625
+ overflow: hidden;
626
+ margin-bottom: 20px
627
+ }
628
+
629
+ .progress-bar {
630
+ height: 100%;
631
+ background-color: #4f46e5;
632
+ width: calc(var(--current) / var(--total) * 100%);
633
+ transition: width 0.5s ease-in-out
634
+ }
635
+
636
+ /* 컴포넌트 특정 스타일 */
637
+ #component-8, .button_total {
638
+ height: 100%;
639
+ align-self: stretch;
640
+ }
641
+
642
+ #loaded_loras [data-testid="block-info"] {
643
+ font-size: 80%
644
+ }
645
+
646
+ #custom_lora_structure {
647
+ background: var(--block-background-fill)
648
+ }
649
+
650
+ #custom_lora_btn {
651
+ margin-top: auto;
652
+ margin-bottom: 11px
653
+ }
654
+
655
+ #random_btn {
656
+ font-size: 300%
657
+ }
658
+
659
+ #component-11 {
660
+ align-self: stretch;
661
+ }
662
+
663
+ /* 갤러리 메인 스타일 */
664
  #lora_gallery {
665
  margin: 20px 0;
666
  padding: 10px;
 
673
  display: block !important;
674
  }
675
 
676
+ /* 갤러리 그리드 스타일 */
677
  #gallery {
678
  display: grid !important;
679
  grid-template-columns: repeat(10, 1fr) !important;
 
685
  max-width: 100% !important;
686
  }
687
 
688
+ /* 갤러리 아이템 스타일 */
689
  .gallery-item {
690
  position: relative !important;
691
  width: 100% !important;
 
697
  overflow: hidden;
698
  }
699
 
 
700
  .gallery-item img {
701
  width: 100% !important;
702
  height: 100% !important;
 
707
  /* 갤러리 그리드 래퍼 */
708
  .wrap, .svelte-w6dy5e {
709
  display: grid !important;
710
+ grid-template-columns: repeat(10, 1fr) !important;
711
  gap: 10px !important;
712
  width: 100% !important;
713
  max-width: 100% !important;
714
  }
715
 
716
+ /* 컨테이너 공통 스타일 */
717
  .container, .content, .block, .contain {
718
  width: 100% !important;
719
  max-width: 100% !important;
 
721
  padding: 0 !important;
722
  }
723
 
 
724
  .row {
725
  width: 100% !important;
726
  margin: 0 !important;
727
  padding: 0 !important;
728
  }
729
 
730
+ /* 버튼 스타일 */
731
  .button_total {
732
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
733
  transition: all 0.3s ease;
 
738
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
739
  }
740
 
741
+ /* 입력 필드 스타일 */
742
  input, textarea {
743
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
744
  transition: all 0.3s ease;
 
748
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
749
  }
750
 
751
+ /* 컴포넌트 border-radius */
752
  .gradio-container .input,
753
  .gradio-container .button,
754
  .gradio-container .block {
755
  border-radius: 12px;
756
  }
757
 
758
+ /* 스크롤바 스타일 */
759
  #gallery::-webkit-scrollbar {
760
  width: 8px;
761
  }
 
774
  background: #555;
775
  }
776
 
777
+ /* Flex 컨테이너 */
778
  .flex {
779
  width: 100% !important;
780
  max-width: 100% !important;
781
  display: flex !important;
782
  }
783
 
784
+ /* Svelte 특정 클래스 */
785
  .svelte-1p9xokt {
786
  width: 100% !important;
787
  max-width: 100% !important;
788
  }
789
 
790
+ /* Footer 숨김 */
791
+ #footer {
792
+ visibility: hidden;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
793
  }
794
 
795
+ /* 결과 이미지 컨테이너 스타일 */
796
+ #result_column, #result_column > div {
797
+ display: flex !important;
798
+ flex-direction: column !important;
799
+ align-items: center !important;
800
+ width: 100% !important;
801
  margin: 0 auto !important;
802
  }
803
 
804
+ .generated-image, .generated-image > div {
805
+ display: flex !important;
806
+ justify-content: center !important;
807
+ align-items: center !important;
808
  width: 90% !important;
809
+ max-width: 768px !important;
810
  margin: 0 auto !important;
811
  }
812
 
813
+ .generated-image img {
 
 
814
  margin: 0 auto !important;
815
+ display: block !important;
816
+ max-width: 100% !important;
817
  }
818
 
819
+ /* 히스토리 갤러리 */
820
  .history-gallery {
821
+ display: flex !important;
822
+ justify-content: center !important;
823
  width: 90% !important;
824
+ max-width: 90% !important;
825
  margin: 0 auto !important;
826
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
827
  '''
828
 
829
  with gr.Blocks(theme=custom_theme, css=css, delete_cache=(60, 3600)) as app:
 
903
  with gr.Row():
904
  remove_button_3 = gr.Button("Remove", size="sm")
905
 
906
+
907
+ # Result and Progress Area
908
+ with gr.Column(elem_id="result_column"):
909
  progress_bar = gr.Markdown(elem_id="progress", visible=False)
910
+ with gr.Box(elem_id="result_box"): # Box 컴포넌트 추가
911
+ result = gr.Image(
912
+ label="Generated Image",
913
+ interactive=False,
914
+ elem_classes=["generated-image"],
915
+ container=True,
916
+ elem_id="result_image",
917
+ width="100%" # 너비 명시적 지정
918
+ )
919
  with gr.Accordion("History", open=False):
920
  history_gallery = gr.Gallery(
921
  label="History",
 
927
 
928
 
929
 
930
+
931
  # Advanced Settings
932
  with gr.Row():
933
  with gr.Accordion("Advanced Settings", open=False):