legoandmars commited on
Commit
4c16d19
·
1 Parent(s): 8dd316c

new logic for transparency

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -125,8 +125,11 @@ def inpaint(input_img, input_img_with_mask, prompt):
125
  input_img_256 = input_img.convert('RGB').resize((256, 256), resample=Image.BICUBIC)
126
  input_img_64 = input_img.convert('RGB').resize((64, 64), resample=Image.BICUBIC)
127
 
128
- input_img_with_mask_64 = input_img.convert('RGBA').getchannel('A').resize((64, 64), resample=Image.BICUBIC)
129
- return input_img_with_mask_64,input_img_with_mask_64
 
 
 
130
  # Source image we are inpainting
131
  source_image_256 = pil_to_numpy(input_img_256)
132
  source_image_64 = pil_to_numpy(input_img_64)
 
125
  input_img_256 = input_img.convert('RGB').resize((256, 256), resample=Image.BICUBIC)
126
  input_img_64 = input_img.convert('RGB').resize((64, 64), resample=Image.BICUBIC)
127
 
128
+ input_img_with_mask_converted = input_img.convert('RGBA')
129
+ input_img_with_mask_64 = input_img_with_mask_converted.getchannel( 'A' ) # Mode 'L'
130
+
131
+ input_img_with_mask_64 = input_img_with_mask_64.resize((64, 64), resample=Image.BICUBIC)
132
+ return input_img, input_img_with_mask_64
133
  # Source image we are inpainting
134
  source_image_256 = pil_to_numpy(input_img_256)
135
  source_image_64 = pil_to_numpy(input_img_64)