MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / extra_batch_images

Function extra_batch_images

ui/easydiffusion/backends/webui_common.py:563–627  ·  view source on GitHub ↗
(
    images,  # list of PIL images
    name_list=None,  # list of image names
    resize_mode=0,
    show_extras_results=True,
    gfpgan_visibility=0,
    codeformer_visibility=0,
    codeformer_weight=0,
    upscaling_resize=2,
    upscaling_resize_w=512,
    upscaling_resize_h=512,
    upscaling_crop=True,
    upscaler_1="None",
    upscaler_2="None",
    extras_upscaler_2_visibility=0,
    upscale_first=False,
    use_async=False,
    input_type="pil",
)

Source from the content-addressed store, hash-verified

561
562
563def extra_batch_images(
564 images, # list of PIL images
565 name_list=None, # list of image names
566 resize_mode=0,
567 show_extras_results=True,
568 gfpgan_visibility=0,
569 codeformer_visibility=0,
570 codeformer_weight=0,
571 upscaling_resize=2,
572 upscaling_resize_w=512,
573 upscaling_resize_h=512,
574 upscaling_crop=True,
575 upscaler_1="None",
576 upscaler_2="None",
577 extras_upscaler_2_visibility=0,
578 upscale_first=False,
579 use_async=False,
580 input_type="pil",
581):
582 if name_list is not None:
583 if len(name_list) != len(images):
584 raise RuntimeError("len(images) != len(name_list)")
585 else:
586 name_list = [f"image{i + 1:05}" for i in range(len(images))]
587
588 if input_type == "pil":
589 images = [img_to_base64_str(x) for x in images]
590
591 image_list = []
592 for name, image in zip(name_list, images):
593 image_list.append({"data": image, "name": name})
594
595 payload = {
596 "resize_mode": resize_mode,
597 "show_extras_results": show_extras_results,
598 "gfpgan_visibility": gfpgan_visibility,
599 "codeformer_visibility": codeformer_visibility,
600 "codeformer_weight": codeformer_weight,
601 "upscaling_resize": upscaling_resize,
602 "upscaling_resize_w": upscaling_resize_w,
603 "upscaling_resize_h": upscaling_resize_h,
604 "upscaling_crop": upscaling_crop,
605 "upscaler_1": upscaler_1,
606 "upscaler_2": upscaler_2,
607 "extras_upscaler_2_visibility": extras_upscaler_2_visibility,
608 "upscale_first": upscale_first,
609 "imageList": image_list,
610 }
611
612 res = webui_post("/sdapi/v1/extra-batch-images", json=payload)
613 if res.status_code == 200:
614 res = res.json()
615 else:
616 raise Exception(
617 "The engine failed while filtering this image. Please check the logs in the command-line window for more details."
618 )
619
620 images = res["images"]

Callers 1

filter_imagesFunction · 0.85

Calls 4

webui_postFunction · 0.85
appendMethod · 0.80
jsonMethod · 0.45

Tested by

no test coverage detected