Update app.py
Browse files
app.py
CHANGED
|
@@ -21,9 +21,16 @@ pipe.to(device)
|
|
| 21 |
|
| 22 |
gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
def infer(prompt, init_image):
|
| 25 |
-
init_image =
|
| 26 |
-
init_image = init_image.resize((512, 512))
|
| 27 |
#image = pipe(prompt, init_image=init_image)["sample"][0]
|
| 28 |
images_list = pipe([prompt] * 2, init_image=init_image, strength=0.75)
|
| 29 |
images = []
|
|
|
|
| 21 |
|
| 22 |
gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
|
| 23 |
|
| 24 |
+
def resize(width,img):
|
| 25 |
+
basewidth = width
|
| 26 |
+
img = Image.open(img)
|
| 27 |
+
wpercent = (basewidth/float(img.size[0]))
|
| 28 |
+
hsize = int((float(img.size[1])*float(wpercent)))
|
| 29 |
+
img = img.resize((basewidth,hsize), Image.ANTIALIAS)
|
| 30 |
+
return img
|
| 31 |
+
|
| 32 |
def infer(prompt, init_image):
|
| 33 |
+
init_image = resize(512,init_image)
|
|
|
|
| 34 |
#image = pipe(prompt, init_image=init_image)["sample"][0]
|
| 35 |
images_list = pipe([prompt] * 2, init_image=init_image, strength=0.75)
|
| 36 |
images = []
|