mix1009 / sdwebuiapi

Python API client for AUTOMATIC1111/stable-diffusion-webui
MIT License
1.35k stars 180 forks source link

SwinIR_4x upscaling not working because of incorrect naming #14

Open trojblue opened 1 year ago

trojblue commented 1 year ago

in webuiapi.py:

class Upscaler(str, Enum):
    none = 'None'
    Lanczos = 'Lanczos'
    Nearest = 'Nearest'
    LDSR = 'LDSR'
    BSRGAN = 'BSRGAN'
    ESRGAN_4x = 'ESRGAN_4x'
    R_ESRGAN_General_4xV3 = 'R-ESRGAN General 4xV3'
    ScuNET_GAN = 'ScuNET GAN'
    ScuNET_PSNR = 'ScuNET PSNR'
    SwinIR_4x = 'SwinIR 4x'

It should be SwinIR_4x instead of spaces.

mix1009 commented 1 year ago

Which API did you use?

스크린샷 2023-02-21 오후 8 19 47

If I pass 'SwinIR_4x' to extra_single_image it returns 500 error.

trojblue commented 1 year ago

Which API did you use?

스크린샷 2023-02-21 오후 8 19 47

If I pass 'SwinIR_4x' to extra_single_image it returns 500 error.

I'm using extra_batch_images. using the default values of webuiapi.Upscaler.SwinIR_4x gives "could not find upscaler named SwinIR 4x".

    api = webuiapi.WebUIApi()
    upscale_results = api.extra_batch_images(images=img_files,
                                             upscaler_1=webuiapi.Upscaler.SwinIR_4x,
                                             upscaler_2=webuiapi.Upscaler.SwinIR_4x,
                                             extras_upscaler_2_visibility=0.65,
                                             gfpgan_visibility=0.15,
                                             upscaling_resize=2)

console:

...
  File "D:\APP\0Drivers\Python310\lib\site-packages\webuiapi\webuiapi.py", line 372, in extra_batch_images
    return self._to_api_result(response)
  File "D:\APP\0Drivers\Python310\lib\site-packages\webuiapi\webuiapi.py", line 80, in _to_api_result
    raise RuntimeError(response.status_code, response.text)
RuntimeError: (500, 'Internal Server Error')

webui:

  File "O:\webui2\modules\postprocessing.py", line 103, in run_extras
    return run_postprocessing(extras_mode, image, image_folder, input_dir, output_dir, show_extras_results, *args, save_output=save_output)
  File "O:\webui2\modules\postprocessing.py", line 56, in run_postprocessing
    scripts.scripts_postproc.run(pp, args)
  File "O:\webui2\modules\scripts_postprocessing.py", line 130, in run
    script.process(pp, **process_args)
  File "O:\webui2\scripts\postprocessing_upscale.py", line 83, in process
    assert upscaler1 or (upscaler_1_name is None), f'could not find upscaler named {upscaler_1_name}'
AssertionError: could not find upscaler named SwinIR 4x

I'm not sure if the name has changed, but I'm using Feb5 commit of webui. commit idea9bd9fc7409109adcd61b897abc2c8881161256