r3gm commited on
Commit
3e25783
1 Parent(s): e10b013

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -17
app.py CHANGED
@@ -314,11 +314,11 @@ upscaler_dict_gui = {
314
  "realesr-animevideov3": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-animevideov3.pth",
315
  "realesr-general-x4v3": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-x4v3.pth",
316
  "realesr-general-wdn-x4v3": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-wdn-x4v3.pth",
317
- "4x-UltraSharp" : "https://huggingface.co/Shandypur/ESRGAN-4x-UltraSharp/resolve/main/4x-UltraSharp.pth",
318
  "4x_foolhardy_Remacri": "https://huggingface.co/FacehugmanIII/4x_foolhardy_Remacri/resolve/main/4x_foolhardy_Remacri.pth",
319
  "Remacri4xExtraSmoother": "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/Remacri%204x%20ExtraSmoother.pth",
320
  "AnimeSharp4x": "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/AnimeSharp%204x.pth",
321
- "lollypop" : "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/lollypop.pth",
322
  "RealisticRescaler4x": "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/RealisticRescaler%204x.pth",
323
  "NickelbackFS4x": "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/NickelbackFS%204x.pth"
324
  }
@@ -750,13 +750,6 @@ class GuiSD:
750
  "ip_adapter_scale": params_ip_scale,
751
  }
752
 
753
- random_number = random.randint(1, 100)
754
- if random_number < 25 and num_images < 3:
755
- if not upscaler_model and steps < 45 and task in ["txt2img", "img2img"] and not adetailer_active_a and not adetailer_active_b:
756
- num_images *=2
757
- pipe_params["num_images"] = num_images
758
- gr.Info("Num images x 2 🎉")
759
-
760
  info_state = "PROCESSING "
761
  for img, seed, image_path, metadata in self.model(**pipe_params):
762
  info_state += ">"
@@ -775,7 +768,8 @@ class GuiSD:
775
  for i, path in enumerate(image_path)
776
  ]
777
  )
778
- info_state += f"<br>{download_links}"
 
779
 
780
  yield img, info_state
781
 
@@ -791,7 +785,7 @@ sdxl_task = [k for k, v in task_stablepy.items() if v in SDXL_TASKS ]
791
  sd_task = [k for k, v in task_stablepy.items() if v in SD15_TASKS ]
792
  def update_task_options(model_name, task_name):
793
  if model_name in model_list:
794
- if "xl" in model_name.lower():
795
  new_choices = sdxl_task
796
  else:
797
  new_choices = sd_task
@@ -803,6 +797,7 @@ def update_task_options(model_name, task_name):
803
  else:
804
  return gr.update(value=task_name, choices=task_model_list)
805
 
 
806
 
807
  with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
808
  gr.Markdown("# 🧩 DiffuseCraft")
@@ -950,7 +945,7 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
950
  esrgan_tile_overlap_gui = gr.Slider(minimum=1, maximum=200, step=1, value=10, label="ESRGAN Tile Overlap")
951
  hires_steps_gui = gr.Slider(minimum=0, value=30, maximum=100, step=1, label="Hires Steps")
952
  hires_denoising_strength_gui = gr.Slider(minimum=0.1, maximum=1.0, step=0.01, value=0.55, label="Hires Denoising Strength")
953
- hires_sampler_gui = gr.Dropdown(label="Hires Sampler", choices=["Use same sampler"] + scheduler_names[:-1], value="Use same sampler")
954
  hires_prompt_gui = gr.Textbox(label="Hires Prompt", placeholder="Main prompt will be use", lines=3)
955
  hires_negative_prompt_gui = gr.Textbox(label="Hires Negative Prompt", placeholder="Main negative prompt will be use", lines=3)
956
 
@@ -1077,8 +1072,7 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
1077
  adetailer_verbose_gui = gr.Checkbox(label="Verbose", value=False)
1078
 
1079
  # Adetailer Sampler
1080
- adetailer_sampler_options = ["Use same sampler"] + scheduler_names[:-1]
1081
- adetailer_sampler_gui = gr.Dropdown(label="Adetailer sampler:", choices=adetailer_sampler_options, value="Use same sampler")
1082
 
1083
  with gr.Accordion("Detailfix A", open=False, visible=True):
1084
  # Adetailer A
@@ -1107,7 +1101,7 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
1107
  mask_padding_b_gui = gr.Number(label="Mask padding:", value=32, minimum=1)
1108
 
1109
  with gr.Accordion("Other settings", open=False, visible=True):
1110
- image_previews_gui = gr.Checkbox(value=True, label="Image Previews")
1111
  hires_before_adetailer_gui = gr.Checkbox(value=False, label="Hires Before Adetailer")
1112
  hires_after_adetailer_gui = gr.Checkbox(value=True, label="Hires After Adetailer")
1113
  generator_in_cpu_gui = gr.Checkbox(value=False, label="Generator in CPU")
@@ -1118,7 +1112,7 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
1118
  leave_progress_bar_gui = gr.Checkbox(value=True, label="Leave Progress Bar")
1119
  disable_progress_bar_gui = gr.Checkbox(value=False, label="Disable Progress Bar")
1120
  display_images_gui = gr.Checkbox(value=True, label="Display Images")
1121
- save_generated_images_gui = gr.Checkbox(value=True, label="Save Generated Images")
1122
  image_storage_location_gui = gr.Textbox(value="./images", label="Image Storage Location")
1123
  retain_compel_previous_load_gui = gr.Checkbox(value=False, label="Retain Compel Previous Load")
1124
  retain_detailfix_model_previous_load_gui = gr.Checkbox(value=False, label="Retain Detailfix Model Previous Load")
@@ -1516,7 +1510,7 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
1516
  def send_img(img_source, img_result):
1517
  return img_source, img_result
1518
  btn_send.click(send_img, [img_source, img_result], [image_control, image_mask_gui])
1519
-
1520
  generate_button.click(
1521
  fn=sd_gen.load_new_model,
1522
  inputs=[
 
314
  "realesr-animevideov3": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-animevideov3.pth",
315
  "realesr-general-x4v3": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-x4v3.pth",
316
  "realesr-general-wdn-x4v3": "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-wdn-x4v3.pth",
317
+ "4x-UltraSharp": "https://huggingface.co/Shandypur/ESRGAN-4x-UltraSharp/resolve/main/4x-UltraSharp.pth",
318
  "4x_foolhardy_Remacri": "https://huggingface.co/FacehugmanIII/4x_foolhardy_Remacri/resolve/main/4x_foolhardy_Remacri.pth",
319
  "Remacri4xExtraSmoother": "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/Remacri%204x%20ExtraSmoother.pth",
320
  "AnimeSharp4x": "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/AnimeSharp%204x.pth",
321
+ "lollypop": "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/lollypop.pth",
322
  "RealisticRescaler4x": "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/RealisticRescaler%204x.pth",
323
  "NickelbackFS4x": "https://huggingface.co/hollowstrawberry/upscalers-backup/resolve/main/ESRGAN/NickelbackFS%204x.pth"
324
  }
 
750
  "ip_adapter_scale": params_ip_scale,
751
  }
752
 
 
 
 
 
 
 
 
753
  info_state = "PROCESSING "
754
  for img, seed, image_path, metadata in self.model(**pipe_params):
755
  info_state += ">"
 
768
  for i, path in enumerate(image_path)
769
  ]
770
  )
771
+ if save_generated_images:
772
+ info_state += f"<br>{download_links}"
773
 
774
  yield img, info_state
775
 
 
785
  sd_task = [k for k, v in task_stablepy.items() if v in SD15_TASKS ]
786
  def update_task_options(model_name, task_name):
787
  if model_name in model_list:
788
+ if "xl" in model_name.lower() or "pony" in model_name.lower():
789
  new_choices = sdxl_task
790
  else:
791
  new_choices = sd_task
 
797
  else:
798
  return gr.update(value=task_name, choices=task_model_list)
799
 
800
+ POST_PROCESSING_SAMPLER = ["Use same sampler"] + scheduler_names[:-2]
801
 
802
  with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
803
  gr.Markdown("# 🧩 DiffuseCraft")
 
945
  esrgan_tile_overlap_gui = gr.Slider(minimum=1, maximum=200, step=1, value=10, label="ESRGAN Tile Overlap")
946
  hires_steps_gui = gr.Slider(minimum=0, value=30, maximum=100, step=1, label="Hires Steps")
947
  hires_denoising_strength_gui = gr.Slider(minimum=0.1, maximum=1.0, step=0.01, value=0.55, label="Hires Denoising Strength")
948
+ hires_sampler_gui = gr.Dropdown(label="Hires Sampler", choices=POST_PROCESSING_SAMPLER, value=POST_PROCESSING_SAMPLER[0])
949
  hires_prompt_gui = gr.Textbox(label="Hires Prompt", placeholder="Main prompt will be use", lines=3)
950
  hires_negative_prompt_gui = gr.Textbox(label="Hires Negative Prompt", placeholder="Main negative prompt will be use", lines=3)
951
 
 
1072
  adetailer_verbose_gui = gr.Checkbox(label="Verbose", value=False)
1073
 
1074
  # Adetailer Sampler
1075
+ adetailer_sampler_gui = gr.Dropdown(label="Adetailer sampler:", choices=POST_PROCESSING_SAMPLER, value=POST_PROCESSING_SAMPLER[0])
 
1076
 
1077
  with gr.Accordion("Detailfix A", open=False, visible=True):
1078
  # Adetailer A
 
1101
  mask_padding_b_gui = gr.Number(label="Mask padding:", value=32, minimum=1)
1102
 
1103
  with gr.Accordion("Other settings", open=False, visible=True):
1104
+ save_generated_images_gui = gr.Checkbox(value=True, label="Create a download link for the images")
1105
  hires_before_adetailer_gui = gr.Checkbox(value=False, label="Hires Before Adetailer")
1106
  hires_after_adetailer_gui = gr.Checkbox(value=True, label="Hires After Adetailer")
1107
  generator_in_cpu_gui = gr.Checkbox(value=False, label="Generator in CPU")
 
1112
  leave_progress_bar_gui = gr.Checkbox(value=True, label="Leave Progress Bar")
1113
  disable_progress_bar_gui = gr.Checkbox(value=False, label="Disable Progress Bar")
1114
  display_images_gui = gr.Checkbox(value=True, label="Display Images")
1115
+ image_previews_gui = gr.Checkbox(value=True, label="Image Previews")
1116
  image_storage_location_gui = gr.Textbox(value="./images", label="Image Storage Location")
1117
  retain_compel_previous_load_gui = gr.Checkbox(value=False, label="Retain Compel Previous Load")
1118
  retain_detailfix_model_previous_load_gui = gr.Checkbox(value=False, label="Retain Detailfix Model Previous Load")
 
1510
  def send_img(img_source, img_result):
1511
  return img_source, img_result
1512
  btn_send.click(send_img, [img_source, img_result], [image_control, image_mask_gui])
1513
+
1514
  generate_button.click(
1515
  fn=sd_gen.load_new_model,
1516
  inputs=[