Manjushri commited on
Commit
375492b
1 Parent(s): 35f17f5

Update app.py

Browse files

Works with any size now.

Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -10,13 +10,10 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
10
  pipe = StableDiffusionInpaintPipeline.from_pretrained("stabilityai/stable-diffusion-2-inpainting", safety_checker=None)
11
  pipe = pipe.to(device)
12
 
13
- def resize(height,img):
14
- baseheight = height
15
- img = Image.open(img)
16
- hpercent = (baseheight/float(img.size[1]))
17
- wsize = int((float(img.size[0])*float(hpercent)))
18
- img = img.resize((wsize,baseheight), Image.Resampling.LANCZOS)
19
- return img
20
 
21
  def predict(source_img, prompt, negative_prompt):
22
  imageio.imwrite("data.png", source_img["image"])
 
10
  pipe = StableDiffusionInpaintPipeline.from_pretrained("stabilityai/stable-diffusion-2-inpainting", safety_checker=None)
11
  pipe = pipe.to(device)
12
 
13
+ def resize(value,img):
14
+ img = Image.open(img)
15
+ img = img.resize((value,value))
16
+ return img
 
 
 
17
 
18
  def predict(source_img, prompt, negative_prompt):
19
  imageio.imwrite("data.png", source_img["image"])