Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -20,12 +20,12 @@ device="cpu"
|
|
20 |
source_img = gr.Image(source="upload", type="filepath", label="init_img")
|
21 |
gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
|
22 |
|
23 |
-
def resize(
|
24 |
-
|
25 |
img = Image.open(img)
|
26 |
-
|
27 |
-
|
28 |
-
img = img.resize((
|
29 |
return img
|
30 |
|
31 |
|
|
|
20 |
source_img = gr.Image(source="upload", type="filepath", label="init_img")
|
21 |
gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[2], height="auto")
|
22 |
|
23 |
+
def resize(height,img):
|
24 |
+
baseheight = height
|
25 |
img = Image.open(img)
|
26 |
+
hpercent = (baseheight/float(img.size[1]))
|
27 |
+
wsize = int((float(img.size[0])*float(hpercent)))
|
28 |
+
img = img.resize((wsize,baseheight), Image.Resampling.LANCZOS)
|
29 |
return img
|
30 |
|
31 |
|