Spaces:
Runtime error
Runtime error
main
Browse files1 unmodified line2345567111 unmodified lines1191201211221231241251261271281291301 unmodified lineimport gradio as grimport torchimport numpy as npimport randomfrom PIL import Imagefrom accelerate import Acceleratorimport os111 unmodified lines
width, height = img.size
# Convert to RGB to remove transparency, fill with white background if necessary if img.mode in ('RGBA', 'LA') or (img.mode == 'P' and 'transparency' in img.info): background = Image.new("RGB", img.size, (fill, fill, fill)) background.paste(img, mask=img.split()[-1]) # Use alpha channel as mask img = background
if width == height: img = img.resize((self.size, self.size), Image.LANCZOS) else:gradio_app.py+6-1