openfree commited on
Commit
67c0e6b
·
verified ·
1 Parent(s): 5b072bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +69 -36
app.py CHANGED
@@ -564,7 +564,6 @@ css = '''
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
- #gallery .grid-wrap{height: 5vh}
568
  #lora_list{background: var(--block-background-fill);padding: 0 1em .3em; font-size: 90%}
569
  .custom_lora_card{margin-bottom: 1em}
570
  .card_internal{display: flex;height: 100px;margin-top: .5em}
@@ -581,47 +580,76 @@ css = '''
581
  #random_btn{font-size: 300%}
582
  #component-11{align-self: stretch;}
583
 
 
584
  #lora_gallery {
585
  margin: 20px 0;
586
  padding: 10px;
587
  border: 1px solid #ddd;
588
- border-radius: 8px;
589
- background: white;
590
  width: 100% !important;
591
  height: 800px !important;
 
 
592
  }
593
 
 
594
  #gallery {
595
  display: grid !important;
596
  grid-template-columns: repeat(6, 1fr) !important;
597
- gap: 10px !important;
598
- padding: 10px !important;
599
  width: 100% !important;
600
  height: 100% !important;
601
  overflow-y: auto !important;
602
  }
603
 
 
 
 
 
 
 
 
 
 
 
 
604
 
 
605
  .gallery-item img {
606
  width: 100% !important;
607
  height: 100% !important;
608
  object-fit: cover !important;
609
- border-radius: 4px !important;
 
 
 
 
 
 
 
610
  }
611
 
612
- .
 
 
 
 
 
613
 
614
- /* 갤러리 컨테이너 강제 너비 설정 */
615
  .gradio-container {
616
  width: 100% !important;
617
  max-width: none !important;
618
  }
619
 
620
- /* 행 강제 너비 설정 */
621
  .row {
622
  width: 100% !important;
623
  margin: 0 !important;
624
  }
 
625
  /* 입체감 있는 버튼 */
626
  .button_total {
627
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
@@ -633,25 +661,6 @@ css = '''
633
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
634
  }
635
 
636
- /* 갤러리 아이템 입체감 */
637
- .gallery-item {
638
- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
639
- transition: transform 0.3s ease, box-shadow 0.3s ease;
640
- border-radius: 12px;
641
- overflow: hidden;
642
- }
643
-
644
- .gallery-item:hover {
645
- transform: translateY(-5px) scale(1.02);
646
- box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
647
- }
648
-
649
- /* 입체감 있는 컨테이너 */
650
- #lora_gallery {
651
- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
652
- background: linear-gradient(to bottom right, #ffffff, #f8f9fa);
653
- }
654
-
655
  /* 입체감 있는 입력 필드 */
656
  input, textarea {
657
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
@@ -665,12 +674,29 @@ input:focus, textarea:focus {
665
  /* 컴포넌트들의 border-radius 설정 */
666
  .gradio-container .input,
667
  .gradio-container .button,
668
- .gradio-container .block,
669
- .gallery-item,
670
- #lora_gallery {
671
  border-radius: 12px;
672
  }
673
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
674
  #footer {visibility: hidden;}
675
  '''
676
 
@@ -686,24 +712,31 @@ with gr.Blocks(theme=custom_theme, css=css, delete_cache=(60, 3600)) as app:
686
  갤러리에서 원하는 모델을 선택(최대 3개까지) < 프롬프트에 한글 또는 영문으로 원하는 내용을 입력 < Generate 버튼 실행
687
  """
688
  )
689
-
690
- # Row에서 theme 매개변수 제거
691
  with gr.Row(elem_id="lora_gallery", equal_height=True):
692
  gallery = gr.Gallery(
693
  value=[(item["image"], item["title"]) for item in loras],
694
  label="LoRA Explorer Gallery",
695
  columns=6,
696
- rows=None,
697
  elem_id="gallery",
698
- height=800,
699
  object_fit="cover",
700
  show_label=True,
701
  allow_preview=False,
702
  show_share_button=False,
703
- container=True,
704
  scale=1,
705
  min_width=1200
 
 
 
 
 
 
 
706
  )
 
 
707
 
708
  with gr.Tab(label="Generate"):
709
  # Prompt and Generate Button
 
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}
 
580
  #random_btn{font-size: 300%}
581
  #component-11{align-self: stretch;}
582
 
583
+ /* 갤러리 메인 컨테이너 */
584
  #lora_gallery {
585
  margin: 20px 0;
586
  padding: 10px;
587
  border: 1px solid #ddd;
588
+ border-radius: 12px;
589
+ background: linear-gradient(to bottom right, #ffffff, #f8f9fa);
590
  width: 100% !important;
591
  height: 800px !important;
592
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
593
+ overflow: hidden;
594
  }
595
 
596
+ /* 갤러리 그리드 컨테이너 */
597
  #gallery {
598
  display: grid !important;
599
  grid-template-columns: repeat(6, 1fr) !important;
600
+ gap: 15px !important;
601
+ padding: 15px !important;
602
  width: 100% !important;
603
  height: 100% !important;
604
  overflow-y: auto !important;
605
  }
606
 
607
+ /* 갤러리 아이템 */
608
+ .gallery-item {
609
+ position: relative !important;
610
+ width: 100% !important;
611
+ aspect-ratio: 1 !important;
612
+ margin: 0 !important;
613
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
614
+ transition: transform 0.3s ease, box-shadow 0.3s ease;
615
+ border-radius: 12px;
616
+ overflow: hidden;
617
+ }
618
 
619
+ /* 갤러리 이미지 */
620
  .gallery-item img {
621
  width: 100% !important;
622
  height: 100% !important;
623
  object-fit: cover !important;
624
+ border-radius: 12px !important;
625
+ }
626
+
627
+ /* 갤러리 아이템 호버 효과 */
628
+ .gallery-item:hover {
629
+ transform: translateY(-5px) scale(1.02);
630
+ box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
631
+ z-index: 1;
632
  }
633
 
634
+ /* 갤러리 그리드 래퍼 */
635
+ .grid-wrap {
636
+ width: 100% !important;
637
+ height: 100% !important;
638
+ overflow: visible !important;
639
+ }
640
 
641
+ /* 갤러리 컨테이너 기본 설정 */
642
  .gradio-container {
643
  width: 100% !important;
644
  max-width: none !important;
645
  }
646
 
647
+ /* 행 설정 */
648
  .row {
649
  width: 100% !important;
650
  margin: 0 !important;
651
  }
652
+
653
  /* 입체감 있는 버튼 */
654
  .button_total {
655
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
 
661
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
662
  }
663
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
664
  /* 입체감 있는 입력 필드 */
665
  input, textarea {
666
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
 
674
  /* 컴포넌트들의 border-radius 설정 */
675
  .gradio-container .input,
676
  .gradio-container .button,
677
+ .gradio-container .block {
 
 
678
  border-radius: 12px;
679
  }
680
 
681
+ /* 갤러리 스크롤바 스타일링 */
682
+ #gallery::-webkit-scrollbar {
683
+ width: 8px;
684
+ }
685
+
686
+ #gallery::-webkit-scrollbar-track {
687
+ background: #f1f1f1;
688
+ border-radius: 4px;
689
+ }
690
+
691
+ #gallery::-webkit-scrollbar-thumb {
692
+ background: #888;
693
+ border-radius: 4px;
694
+ }
695
+
696
+ #gallery::-webkit-scrollbar-thumb:hover {
697
+ background: #555;
698
+ }
699
+
700
  #footer {visibility: hidden;}
701
  '''
702
 
 
712
  갤러리에서 원하는 모델을 선택(최대 3개까지) < 프롬프트에 한글 또는 영문으로 원하는 내용을 입력 < Generate 버튼 실행
713
  """
714
  )
715
+ # Gallery 컴포넌트 수정
 
716
  with gr.Row(elem_id="lora_gallery", equal_height=True):
717
  gallery = gr.Gallery(
718
  value=[(item["image"], item["title"]) for item in loras],
719
  label="LoRA Explorer Gallery",
720
  columns=6,
721
+ rows="auto", # 자동 행 조정
722
  elem_id="gallery",
723
+ height="800px",
724
  object_fit="cover",
725
  show_label=True,
726
  allow_preview=False,
727
  show_share_button=False,
 
728
  scale=1,
729
  min_width=1200
730
+ ).style(
731
+ grid_cols=6,
732
+ grid_rows="auto",
733
+ height="800px",
734
+ width="100%",
735
+ container=True,
736
+ full_width=True
737
  )
738
+
739
+
740
 
741
  with gr.Tab(label="Generate"):
742
  # Prompt and Generate Button