Keltezaa commited on
Commit
2b1c55a
·
verified ·
1 Parent(s): 8732b8e

Update app.py

Browse files

added 2 more custom lora slots for more variance capability It will now be possable to have 4 celebrity's together in the same image, or fewer but with more styled extra options. or various combinations.

-Enjoy and remember to use responsibly. This is a public service and I will not be held accountable for what you do with it.

;p

Files changed (1) hide show
  1. app.py +43 -38
app.py CHANGED
@@ -575,7 +575,7 @@ def update_history(new_image, history):
575
  css = '''
576
  #gen_btn{height: 100%}
577
  #title{text-align: center}
578
- #title h1{font-size: 3em; display:inline-flex; align-items:center}
579
  #title img{width: 100px; margin-right: 0.25em}
580
  #gallery .grid-wrap{height: 5vh}
581
  #lora_list{background: var(--block-background-fill);padding: 0 1em .3em; font-size: 90%}
@@ -594,14 +594,10 @@ css = '''
594
  #random_btn{font-size: 300%}
595
  #component-11{align-self: stretch;}
596
  '''
597
-
598
- with gr.Blocks(css=css, delete_cache=(240, 240)) as app:
599
  title = gr.HTML(
600
- """<h1><img src="https://huggingface.co/spaces/Keltezaa/Celebrity_LoRa_Mix/blob/main/solo-traveller_16875043.png" alt=" "> Celebrity LoRa Mix</h1><br><span style="
601
- margin-top: -25px !important;
602
- display: block;
603
- margin-left: 37px;
604
- ">SFW & NSFW FLUX LoRAs</span>""",
605
  elem_id="title",
606
  )
607
  loras_state = gr.State(loras)
@@ -639,27 +635,27 @@ with gr.Blocks(css=css, delete_cache=(240, 240)) as app:
639
  with gr.Column(scale=1,min_width=50):
640
  randomize_button = gr.Button("🎲", variant="secondary", scale=1, elem_id="random_btn")
641
 
642
- # with gr.Row(elem_id="loaded_loras"):
643
- # with gr.Column(scale=8):
644
- # with gr.Row():
645
- # with gr.Column(scale=0, min_width=50):
646
- # lora_image_3 = gr.Image(label="LoRA 3 Image", interactive=False, width=50, show_label=False, show_share_button=False, show_download_button=False, show_fullscreen_button=False, height=50)
647
- # with gr.Column(scale=3, min_width=100):
648
- # selected_info_3 = gr.Markdown("Select a LoRA 3")
649
- # with gr.Column(scale=5, min_width=50):
650
- # lora_scale_3 = gr.Slider(label="LoRA 3 Scale", minimum=0, maximum=3, step=0.05, value=0.5)
651
- # with gr.Row():
652
- # remove_button_3 = gr.Button("Remove", size="sm")
653
- # with gr.Column(scale=8):
654
- # with gr.Row():
655
- # with gr.Column(scale=0, min_width=50):
656
- # lora_image_4 = gr.Image(label="LoRA 4 Image", interactive=False, width=50, show_label=False, show_share_button=False, show_download_button=False, show_fullscreen_button=False, height=50)
657
- # with gr.Column(scale=3, min_width=100):
658
- # selected_info_4 = gr.Markdown("Select a LoRA 4")
659
- # with gr.Column(scale=5, min_width=150):
660
- # lora_scale_4 = gr.Slider(label="LoRA 4 Scale", minimum=0, maximum=3, step=0.05, value=0.5)
661
- # with gr.Row():
662
- # remove_button_4 = gr.Button("Remove", size="sm")
663
 
664
  with gr.Row():
665
  with gr.Accordion("Advanced Settings", open=True):
@@ -702,44 +698,53 @@ with gr.Blocks(css=css, delete_cache=(240, 240)) as app:
702
  )
703
  with gr.Column():
704
  progress_bar = gr.Markdown(elem_id="progress", visible=False)
705
- result = gr.Image(label="Image", interactive=False, show_share_button=False)
706
-
707
  # with gr.Accordion("History", open=False):
708
  # history_gallery = gr.Gallery(label="History", columns=6, object_fit="contain", interactive=False)
709
 
710
  gallery.select(
711
  update_selection,
712
  inputs=[selected_indices, loras_state, width, height],
713
- outputs=[prompt, selected_info_1, selected_info_2, selected_indices, lora_scale_1, lora_scale_2, width, height, lora_image_1, lora_image_2])
714
  remove_button_1.click(
715
  remove_lora_1,
716
  inputs=[selected_indices, loras_state],
717
- outputs=[selected_info_1, selected_info_2, selected_indices, lora_scale_1, lora_scale_2, lora_image_1, lora_image_2]
718
  )
719
  remove_button_2.click(
720
  remove_lora_2,
721
  inputs=[selected_indices, loras_state],
722
- outputs=[selected_info_1, selected_info_2, selected_indices, lora_scale_1, lora_scale_2, lora_image_1, lora_image_2]
 
 
 
 
 
 
 
 
 
 
723
  )
724
  randomize_button.click(
725
  randomize_loras,
726
  inputs=[selected_indices, loras_state],
727
- outputs=[selected_info_1, selected_info_2, selected_indices, lora_scale_1, lora_scale_2, lora_image_1, lora_image_2, prompt]
728
  )
729
  add_custom_lora_button.click(
730
  add_custom_lora,
731
  inputs=[custom_lora, selected_indices, loras_state, gallery],
732
- outputs=[loras_state, gallery, selected_info_1, selected_info_2, selected_indices, lora_scale_1, lora_scale_2, lora_image_1, lora_image_2]
733
  )
734
  remove_custom_lora_button.click(
735
  remove_custom_lora,
736
  inputs=[selected_indices, loras_state, gallery],
737
- outputs=[loras_state, gallery, selected_info_1, selected_info_2, selected_indices, lora_scale_1, lora_scale_2, lora_image_1, lora_image_2]
738
  )
739
  gr.on(
740
  triggers=[generate_button.click, prompt.submit],
741
  fn=run_lora,
742
- inputs=[prompt, cfg_scale, steps, selected_indices, lora_scale_1, lora_scale_2, randomize_seed, seed, width, height, loras_state],
743
  outputs=[result, seed, progress_bar]
744
  )#.then(
745
  # fn=lambda x, history: update_history(x, history),
 
575
  css = '''
576
  #gen_btn{height: 100%}
577
  #title{text-align: center}
578
+ #title h1{font-size: 2em; display:inline-flex; align-items:center}
579
  #title img{width: 100px; margin-right: 0.25em}
580
  #gallery .grid-wrap{height: 5vh}
581
  #lora_list{background: var(--block-background-fill);padding: 0 1em .3em; font-size: 90%}
 
594
  #random_btn{font-size: 300%}
595
  #component-11{align-self: stretch;}
596
  '''
597
+ font=[gr.themes.GoogleFont("Source Sans Pro"), "Arial", "sans-serif"]
598
+ with gr.Blocks(theme=gr.themes.Soft(font=font), css=css, delete_cache=(256, 256)) as app:
599
  title = gr.HTML(
600
+ """<h1><img src="https://huggingface.co/spaces/keltezaa/Celebrity_pony_NSFW_Mix/resolve/main/solo-traveller_16875043.png" alt="LoRA"> Celebrity Pony NSFW Mix</h1>""",
 
 
 
 
601
  elem_id="title",
602
  )
603
  loras_state = gr.State(loras)
 
635
  with gr.Column(scale=1,min_width=50):
636
  randomize_button = gr.Button("🎲", variant="secondary", scale=1, elem_id="random_btn")
637
 
638
+ with gr.Row(elem_id="loaded_loras"):
639
+ with gr.Column(scale=8):
640
+ with gr.Row():
641
+ with gr.Column(scale=0, min_width=50):
642
+ lora_image_3 = gr.Image(label="LoRA 3 Image", interactive=False, width=50, show_label=False, show_share_button=False, show_download_button=False, show_fullscreen_button=False, height=50)
643
+ with gr.Column(scale=3, min_width=100):
644
+ selected_info_3 = gr.Markdown("Select a LoRA 3")
645
+ with gr.Column(scale=5, min_width=50):
646
+ lora_scale_3 = gr.Slider(label="LoRA 3 Scale", minimum=0, maximum=3, step=0.05, value=0.5)
647
+ with gr.Row():
648
+ remove_button_3 = gr.Button("Remove", size="sm")
649
+ with gr.Column(scale=8):
650
+ with gr.Row():
651
+ with gr.Column(scale=0, min_width=50):
652
+ lora_image_4 = gr.Image(label="LoRA 4 Image", interactive=False, width=50, show_label=False, show_share_button=False, show_download_button=False, show_fullscreen_button=False, height=50)
653
+ with gr.Column(scale=3, min_width=100):
654
+ selected_info_4 = gr.Markdown("Select a LoRA 4")
655
+ with gr.Column(scale=5, min_width=150):
656
+ lora_scale_4 = gr.Slider(label="LoRA 4 Scale", minimum=0, maximum=3, step=0.05, value=0.5)
657
+ with gr.Row():
658
+ remove_button_4 = gr.Button("Remove", size="sm")
659
 
660
  with gr.Row():
661
  with gr.Accordion("Advanced Settings", open=True):
 
698
  )
699
  with gr.Column():
700
  progress_bar = gr.Markdown(elem_id="progress", visible=False)
701
+ result = gr.Image(label="Generated Image", interactive=False, show_share_button=False)
 
702
  # with gr.Accordion("History", open=False):
703
  # history_gallery = gr.Gallery(label="History", columns=6, object_fit="contain", interactive=False)
704
 
705
  gallery.select(
706
  update_selection,
707
  inputs=[selected_indices, loras_state, width, height],
708
+ outputs=[prompt, selected_info_1, selected_info_2, selected_info_3, selected_info_4, selected_indices, lora_scale_1, lora_scale_2, lora_scale_3, lora_scale_4, width, height, lora_image_1, lora_image_2, lora_image_3, lora_image_4])
709
  remove_button_1.click(
710
  remove_lora_1,
711
  inputs=[selected_indices, loras_state],
712
+ outputs=[selected_info_1, selected_info_2, selected_info_3, selected_info_4, selected_indices, lora_scale_1, lora_scale_2, lora_scale_3, lora_scale_4, lora_image_1, lora_image_2, lora_image_3, lora_image_4]
713
  )
714
  remove_button_2.click(
715
  remove_lora_2,
716
  inputs=[selected_indices, loras_state],
717
+ outputs=[selected_info_1, selected_info_2, selected_info_3, selected_info_4, selected_indices, lora_scale_1, lora_scale_2, lora_scale_3, lora_scale_4, lora_image_1, lora_image_2, lora_image_3, lora_image_4]
718
+ )
719
+ remove_button_3.click(
720
+ remove_lora_3,
721
+ inputs=[selected_indices, loras_state],
722
+ outputs=[selected_info_1, selected_info_2, selected_info_3, selected_info_4, selected_indices, lora_scale_1, lora_scale_2, lora_scale_3, lora_scale_4, lora_image_1, lora_image_2, lora_image_3, lora_image_4]
723
+ )
724
+ remove_button_4.click(
725
+ remove_lora_4,
726
+ inputs=[selected_indices, loras_state],
727
+ outputs=[selected_info_1, selected_info_2, selected_info_3, selected_info_4, selected_indices, lora_scale_1, lora_scale_2, lora_scale_3, lora_scale_4, lora_image_1, lora_image_2, lora_image_3, lora_image_4]
728
  )
729
  randomize_button.click(
730
  randomize_loras,
731
  inputs=[selected_indices, loras_state],
732
+ outputs=[selected_info_1, selected_info_2, selected_info_3, selected_info_4, selected_indices, lora_scale_1, lora_scale_2, lora_scale_3, lora_scale_4, lora_image_1, lora_image_2, lora_image_3, lora_image_4, prompt]
733
  )
734
  add_custom_lora_button.click(
735
  add_custom_lora,
736
  inputs=[custom_lora, selected_indices, loras_state, gallery],
737
+ outputs=[loras_state, gallery, selected_info_1, selected_info_2, selected_info_3, selected_info_4, selected_indices, lora_scale_1, lora_scale_2, lora_scale_3, lora_scale_4, lora_image_1, lora_image_2, lora_image_3, lora_image_4]
738
  )
739
  remove_custom_lora_button.click(
740
  remove_custom_lora,
741
  inputs=[selected_indices, loras_state, gallery],
742
+ outputs=[loras_state, gallery, selected_info_1, selected_info_2, selected_info_3, selected_info_4, selected_indices, lora_scale_1, lora_scale_2, lora_scale_3, lora_scale_4, lora_image_1, lora_image_2, lora_image_3, lora_image_4]
743
  )
744
  gr.on(
745
  triggers=[generate_button.click, prompt.submit],
746
  fn=run_lora,
747
+ inputs=[prompt, cfg_scale, steps, selected_indices, lora_scale_1, lora_scale_2, lora_scale_3, lora_scale_4, randomize_seed, seed, width, height, loras_state],
748
  outputs=[result, seed, progress_bar]
749
  )#.then(
750
  # fn=lambda x, history: update_history(x, history),