AUTOMATIC1111 / stable-diffusion-webui-extensions

Extension index for stable-diffusion-webui
483 stars 261 forks source link

add sd-webui-aurasr #356

Open AndreyRGW opened 1 month ago

AndreyRGW commented 1 month ago

Info

https://github.com/AndreyRGW/sd-webui-aurasr Integrates AuraSR V2 upscaling feature into stable-diffusion-webui.

Checklist:

light-and-ray commented 1 month ago

I don't see a reason why it's needed to save image before passing into aurasr library. It accepts pil images doesn't it? I remember I tried to make the same extension, but I disliked the result and canceled it. But the 2nd model maybe good

Maybe it doesn't accept pil image for upscaling with tiling, but you can just copy tiling code from other upscalers in sd-webui

light-and-ray commented 1 month ago

Nope, everything is okay https://github.com/fal-ai/aura-sr/blob/main/aura_sr.py#L868 it receives pil image

You make useful saving here

        # Convert the input image to RGB and save it to the input file path
    ->  img.convert('RGB').save(fileIn, quality=100)

        # Get the AuraSR model
        aura_sr = get_aura_sr_model()

        # Open the input image
    ->  input_image = Image.open(fileIn) # <- just use img instead

        # Upscale the input image using AuraSR
        upscaled_image = aura_sr.upscale_4x_overlapped(input_image)

        # Save the upscaled image to the output file path
        upscaled_image.save(fileOut, quality=100)

And also here:

        # Save the upscaled image to the output file path
    ->  upscaled_image.save(fileOut, quality=100)

        # Check if the output file exists
        if not os.path.exists(fileOut):
            raise Exception("AuraSR didn't process any image")

        # Return the output image
    ->  return Image.open(fileOut) # <- just use upscaled_image instead
w-e-w commented 1 month ago

yeah the reason I haven't merged this one was because I read the code and I don't think it makes sense I was in the process of rewriting and the weather becomes 36C in the day so I don't want to work

AndreyRGW commented 1 month ago

yeah the reason I haven't merged this one was because I read the code and I don't think it makes sense I was in the process of rewriting and the weather becomes 36C in the day so I don't want to work

I've edited the code, a little bit

light-and-ray commented 1 month ago

I was in the process of rewriting

I suppose Andrey is a newbie if he makes these mistakes, so it's better for his skill to fix them by himself 😌

w-e-w commented 3 weeks ago

I suppose Andrey is a newbie if he makes these mistakes, so it's better for his skill to fix them by himself 😌

but and the webui may not even have CUDA

for example if you're running on AMD GPU; Mac or CPU

use devices.device or devices.get_device_for('aurasr') if you wish the device to be customizable to get the device and init AuraSR

this need to be fixed be fore adding to index


your install.py is a total mess and bad for load time don't reinvent the wheel, test is required module is already installed and if not install it

in this case there's no real difference between me telling you how it should be done vs doing it for you so I'll just send the PR