Keltezaa commited on
Commit
dd4bd7c
·
verified ·
1 Parent(s): bf6a6eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +68 -41
app.py CHANGED
@@ -495,45 +495,94 @@ css = '''
495
  #component-11{align-self: stretch;}
496
  '''
497
 
498
- with gr.Blocks(css=css, delete_cache=(60, 60)) as app:
499
  title = gr.HTML(
500
- """<h1><img src="solo-traveller_16875043.png" alt="LoRA"> Celebrity LoRa Mix</h1><br><span style="
501
  margin-top: -25px !important;
502
  display: block;
503
  margin-left: 37px;
504
- ">SFW & NSFW Celebrity Fantacy's</span>""",
505
  elem_id="title",
506
  )
507
  loras_state = gr.State(loras)
508
  selected_indices = gr.State([])
 
 
509
  with gr.Row():
510
  with gr.Column(scale=3):
511
  prompt = gr.Textbox(label="Prompt", lines=1, placeholder="Type a prompt after selecting a LoRA")
512
- with gr.Column(scale=1):
513
- generate_button = gr.Button("Generate", variant="primary", elem_classes=["button_total"])
514
  with gr.Row(elem_id="loaded_loras"):
515
- with gr.Column(scale=1, min_width=25):
516
- randomize_button = gr.Button("🎲", variant="secondary", scale=1, elem_id="random_btn")
517
  with gr.Column(scale=8):
518
  with gr.Row():
519
  with gr.Column(scale=0, min_width=50):
520
- lora_image_1 = gr.Image(label="LoRA 1 Image", interactive=False, min_width=50, width=50, show_label=False, show_share_button=False, show_download_button=False, show_fullscreen_button=False, height=50)
521
  with gr.Column(scale=3, min_width=100):
522
  selected_info_1 = gr.Markdown("Select a LoRA 1")
523
  with gr.Column(scale=5, min_width=50):
524
- lora_scale_1 = gr.Slider(label="LoRA 1 Scale", minimum=0, maximum=3, step=0.01, value=1.15)
525
  with gr.Row():
526
  remove_button_1 = gr.Button("Remove", size="sm")
 
527
  with gr.Column(scale=8):
528
  with gr.Row():
529
  with gr.Column(scale=0, min_width=50):
530
- lora_image_2 = gr.Image(label="LoRA 2 Image", interactive=False, min_width=50, width=50, show_label=False, show_share_button=False, show_download_button=False, show_fullscreen_button=False, height=50)
531
  with gr.Column(scale=3, min_width=100):
532
  selected_info_2 = gr.Markdown("Select a LoRA 2")
533
  with gr.Column(scale=5, min_width=50):
534
- lora_scale_2 = gr.Slider(label="LoRA 2 Scale", minimum=0, maximum=3, step=0.01, value=1.15)
535
  with gr.Row():
536
  remove_button_2 = gr.Button("Remove", size="sm")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
537
  with gr.Row():
538
  with gr.Column():
539
  with gr.Group():
@@ -542,37 +591,15 @@ with gr.Blocks(css=css, delete_cache=(60, 60)) as app:
542
  add_custom_lora_button = gr.Button("Add Custom LoRA", elem_id="custom_lora_btn", scale=2, min_width=150)
543
  remove_custom_lora_button = gr.Button("Remove Custom LoRA", visible=False)
544
  gr.Markdown("[Check the list of FLUX LoRAs](https://huggingface.co/models?other=base_model:adapter:black-forest-labs/FLUX.1-dev)", elem_id="lora_list")
545
-
546
- with gr.Row():
547
- with gr.Accordion("Advanced Settings", open=False):
548
- # with gr.Row():
549
- # input_image = gr.Image(label="Input image", type="filepath", show_share_button=False)
550
- # image_strength = gr.Slider(label="Denoise Strength", info="Lower means more image influence", minimum=0.1, maximum=1.0, step=0.01, value=0.75)
551
- with gr.Column():
552
- with gr.Row():
553
- cfg_scale = gr.Slider(label="CFG Scale", minimum=1, maximum=20, step=0.5, value=3.5)
554
- steps = gr.Slider(label="Steps", minimum=1, maximum=50, step=1, value=28)
555
-
556
- with gr.Row():
557
- width = gr.Slider(label="Width", minimum=256, maximum=1536, step=64, value=1024)
558
- height = gr.Slider(label="Height", minimum=256, maximum=1536, step=64, value=1024)
559
-
560
- with gr.Row():
561
- randomize_seed = gr.Checkbox(True, label="Randomize seed")
562
- seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0, randomize=True)
563
-
564
-
565
- with gr.Column():
566
- with gr.Row():
567
  gallery = gr.Gallery(
568
- [(item["image"], item["title"]) for item in loras],
569
- label="Explorer gallery",
570
- allow_preview=False,
571
- columns=5,
572
- elem_id="gallery",
573
- show_share_button=False,
574
- interactive=False
575
- )
576
  with gr.Column():
577
  progress_bar = gr.Markdown(elem_id="progress", visible=False)
578
  result = gr.Image(label="Generated Image", interactive=False, show_share_button=False)
 
495
  #component-11{align-self: stretch;}
496
  '''
497
 
498
+ with gr.Blocks(css=css, delete_cache=(240, 240)) as app:
499
  title = gr.HTML(
500
+ """<h1><img src="Keltezaa/Celebrity_LoRa_Mix" alt=" "> Celebrity LoRa Mix</h1><br><span style="
501
  margin-top: -25px !important;
502
  display: block;
503
  margin-left: 37px;
504
+ ">SFW & NSFW FLUX LoRAs</span>""",
505
  elem_id="title",
506
  )
507
  loras_state = gr.State(loras)
508
  selected_indices = gr.State([])
509
+ trigger_word_display = gr.Markdown("", elem_id="trigger_word")
510
+
511
  with gr.Row():
512
  with gr.Column(scale=3):
513
  prompt = gr.Textbox(label="Prompt", lines=1, placeholder="Type a prompt after selecting a LoRA")
514
+
 
515
  with gr.Row(elem_id="loaded_loras"):
516
+
 
517
  with gr.Column(scale=8):
518
  with gr.Row():
519
  with gr.Column(scale=0, min_width=50):
520
+ lora_image_1 = gr.Image(label="LoRA 1 Image", interactive=False, width=50, show_label=False, show_share_button=False, show_download_button=False, show_fullscreen_button=False, height=50)
521
  with gr.Column(scale=3, min_width=100):
522
  selected_info_1 = gr.Markdown("Select a LoRA 1")
523
  with gr.Column(scale=5, min_width=50):
524
+ lora_scale_1 = gr.Slider(label="LoRA 1 Scale", minimum=0, maximum=3, step=0.05, value=0.5)
525
  with gr.Row():
526
  remove_button_1 = gr.Button("Remove", size="sm")
527
+
528
  with gr.Column(scale=8):
529
  with gr.Row():
530
  with gr.Column(scale=0, min_width=50):
531
+ lora_image_2 = gr.Image(label="LoRA 2 Image", interactive=False, width=50, show_label=False, show_share_button=False, show_download_button=False, show_fullscreen_button=False, height=50)
532
  with gr.Column(scale=3, min_width=100):
533
  selected_info_2 = gr.Markdown("Select a LoRA 2")
534
  with gr.Column(scale=5, min_width=50):
535
+ lora_scale_2 = gr.Slider(label="LoRA 2 Scale", minimum=0, maximum=3, step=0.05, value=0.5)
536
  with gr.Row():
537
  remove_button_2 = gr.Button("Remove", size="sm")
538
+
539
+ with gr.Column(scale=1,min_width=50):
540
+ randomize_button = gr.Button("🎲", variant="secondary", scale=1, elem_id="random_btn")
541
+
542
+ # with gr.Row(elem_id="loaded_loras"):
543
+ # with gr.Column(scale=8):
544
+ # with gr.Row():
545
+ # with gr.Column(scale=0, min_width=50):
546
+ # 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)
547
+ # with gr.Column(scale=3, min_width=100):
548
+ # selected_info_3 = gr.Markdown("Select a LoRA 3")
549
+ # with gr.Column(scale=5, min_width=50):
550
+ # lora_scale_3 = gr.Slider(label="LoRA 3 Scale", minimum=0, maximum=3, step=0.05, value=0.5)
551
+ # with gr.Row():
552
+ # remove_button_3 = gr.Button("Remove", size="sm")
553
+ # with gr.Column(scale=8):
554
+ # with gr.Row():
555
+ # with gr.Column(scale=0, min_width=50):
556
+ # 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)
557
+ # with gr.Column(scale=3, min_width=100):
558
+ # selected_info_4 = gr.Markdown("Select a LoRA 4")
559
+ # with gr.Column(scale=5, min_width=150):
560
+ # lora_scale_4 = gr.Slider(label="LoRA 4 Scale", minimum=0, maximum=3, step=0.05, value=0.5)
561
+ # with gr.Row():
562
+ # remove_button_4 = gr.Button("Remove", size="sm")
563
+
564
+ with gr.Row():
565
+ with gr.Accordion("Advanced Settings", open=False):
566
+ #with gr.Row():
567
+ # input_image = gr.Image(label="Input image", type="filepath", show_share_button=False)
568
+ # image_strength = gr.Slider(label="Denoise Strength", info="Lower means more image influence", minimum=0.1, maximum=1.0, step=0.01, value=0.75)
569
+ with gr.Column():
570
+ with gr.Row():
571
+ cfg_scale = gr.Slider(label="CFG Scale", minimum=1, maximum=20, step=0.5, value=7.5)
572
+ steps = gr.Slider(label="Steps", minimum=1, maximum=50, step=1, value=28)
573
+
574
+ with gr.Row():
575
+ width = gr.Slider(label="Width", minimum=256, maximum=1536, step=64, value=1024)
576
+ height = gr.Slider(label="Height", minimum=256, maximum=1536, step=64, value=1024)
577
+
578
+ with gr.Row():
579
+ randomize_seed = gr.Checkbox(True, label="Randomize seed")
580
+ seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0, randomize=True)
581
+
582
+ with gr.Row():
583
+ with gr.Column(scale=3):
584
+ generate_button = gr.Button("Generate", variant="primary", elem_classes=["button_total"])
585
+
586
  with gr.Row():
587
  with gr.Column():
588
  with gr.Group():
 
591
  add_custom_lora_button = gr.Button("Add Custom LoRA", elem_id="custom_lora_btn", scale=2, min_width=150)
592
  remove_custom_lora_button = gr.Button("Remove Custom LoRA", visible=False)
593
  gr.Markdown("[Check the list of FLUX LoRAs](https://huggingface.co/models?other=base_model:adapter:black-forest-labs/FLUX.1-dev)", elem_id="lora_list")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
594
  gallery = gr.Gallery(
595
+ [(item["image"], item["title"]) for item in loras],
596
+ label="Or pick from the gallery",
597
+ allow_preview=False,
598
+ columns=5,
599
+ elem_id="gallery",
600
+ show_share_button=False,
601
+ interactive=False
602
+ )
603
  with gr.Column():
604
  progress_bar = gr.Markdown(elem_id="progress", visible=False)
605
  result = gr.Image(label="Generated Image", interactive=False, show_share_button=False)