Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sd-webui-aurasr #356

Open
wants to merge 1 commit into
base: extensions
Choose a base branch
from

Conversation

AndreyRGW
Copy link
Contributor

@AndreyRGW AndreyRGW commented Aug 1, 2024

Info

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

Checklist:

  • I have read the Readme.md
  • The description is written in English.
  • The index.json and extension_template.json have not been modified.
  • The entry is placed in the extensions directory with the .json file extension.

@light-and-ray
Copy link
Contributor

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
Copy link
Contributor

light-and-ray commented Aug 20, 2024

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
Copy link
Collaborator

w-e-w commented Aug 20, 2024

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
Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Collaborator

w-e-w commented Aug 28, 2024

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

  • AuraSR defaults to CUDA devices

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

AndreyRGW added a commit to AndreyRGW/sd-webui-aurasr that referenced this pull request Oct 27, 2024
AndreyRGW added a commit to AndreyRGW/sd-webui-aurasr that referenced this pull request Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants