Spaces:
Runtime error
Runtime error
Update app.py
Browse filesWorks with any size now.
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(
|
14 |
-
|
15 |
-
|
16 |
-
|
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"])
|