Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -25,19 +25,20 @@ img_pipe.to(device)
|
|
25 |
source_img = gr.Image(source="upload", type="filepath", label="init_img | 512*512 px")
|
26 |
gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
|
27 |
|
28 |
-
def resize(
|
29 |
#baseheight = value
|
30 |
img = Image.open(img)
|
31 |
#hpercent = (baseheight/float(img.size[1]))
|
32 |
#wsize = int((float(img.size[0])*float(hpercent)))
|
33 |
#img = img.resize((wsize,baseheight), Image.Resampling.LANCZOS)
|
34 |
-
img = img.resize((
|
35 |
return img
|
36 |
|
|
|
37 |
|
38 |
def infer(prompt, source_img):
|
39 |
|
40 |
-
source_image = resize(512, source_img)
|
41 |
source_image.save('source.png')
|
42 |
images_list = img_pipe([prompt] * 2, init_image=source_image, strength=0.75)
|
43 |
images = []
|
|
|
25 |
source_img = gr.Image(source="upload", type="filepath", label="init_img | 512*512 px")
|
26 |
gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
|
27 |
|
28 |
+
def resize(w_val,l_val,img):
|
29 |
#baseheight = value
|
30 |
img = Image.open(img)
|
31 |
#hpercent = (baseheight/float(img.size[1]))
|
32 |
#wsize = int((float(img.size[0])*float(hpercent)))
|
33 |
#img = img.resize((wsize,baseheight), Image.Resampling.LANCZOS)
|
34 |
+
img = img.resize((w_val,l_val), Image.Resampling.LANCZOS)
|
35 |
return img
|
36 |
|
37 |
+
#init_image = init_image.resize((768, 512))
|
38 |
|
39 |
def infer(prompt, source_img):
|
40 |
|
41 |
+
source_image = resize(768, 512, source_img)
|
42 |
source_image.save('source.png')
|
43 |
images_list = img_pipe([prompt] * 2, init_image=source_image, strength=0.75)
|
44 |
images = []
|