Spaces:
Paused
Paused
Commit
•
24b767e
1
Parent(s):
b612b91
Update app.py (#8)
Browse files- Update app.py (53dfd2c355f763f71efe81291f409a71d46487a3)
Co-authored-by: Harsh Pahwa <harshkidzure@users.noreply.huggingface.co>
app.py
CHANGED
@@ -123,15 +123,10 @@ def predict(
|
|
123 |
size1, size2 = input_image["image"].convert("RGB").size
|
124 |
|
125 |
if task != "image-outpainting":
|
126 |
-
|
127 |
-
input_image["image"] = input_image["image"].convert("RGB").resize((640, int(size2 / size1 * 640)))
|
128 |
-
else:
|
129 |
-
input_image["image"] = input_image["image"].convert("RGB").resize((int(size1 / size2 * 640), 640))
|
130 |
else:
|
131 |
-
|
132 |
-
|
133 |
-
else:
|
134 |
-
input_image["image"] = input_image["image"].convert("RGB").resize((int(size1 / size2 * 512), 512))
|
135 |
|
136 |
if task == "image-outpainting" or task == "context-aware":
|
137 |
prompt = prompt + " empty scene"
|
@@ -171,8 +166,8 @@ def predict(
|
|
171 |
|
172 |
W = int(np.shape(img)[0] - np.shape(img)[0] % 8)
|
173 |
H = int(np.shape(img)[1] - np.shape(img)[1] % 8)
|
174 |
-
input_image["image"] = input_image["image"].resize((H, W))
|
175 |
-
input_image["mask"] = input_image["mask"].resize((H, W))
|
176 |
|
177 |
np_inpimg = np.array(input_image["image"])
|
178 |
np_inmask = np.array(input_image["mask"]) / 255.0
|
|
|
123 |
size1, size2 = input_image["image"].convert("RGB").size
|
124 |
|
125 |
if task != "image-outpainting":
|
126 |
+
input_image["image"] = input_image["image"].convert("RGB").resize((1024, 1024), Image.LANCZOS)
|
|
|
|
|
|
|
127 |
else:
|
128 |
+
input_image["image"] = input_image["image"].convert("RGB").resize((1024, 1024), Image.LANCZOS)
|
129 |
+
|
|
|
|
|
130 |
|
131 |
if task == "image-outpainting" or task == "context-aware":
|
132 |
prompt = prompt + " empty scene"
|
|
|
166 |
|
167 |
W = int(np.shape(img)[0] - np.shape(img)[0] % 8)
|
168 |
H = int(np.shape(img)[1] - np.shape(img)[1] % 8)
|
169 |
+
input_image["image"] = input_image["image"].resize((H, W), Image.LANCZOS)
|
170 |
+
input_image["mask"] = input_image["mask"].resize((H, W), Image.LANCZOS)
|
171 |
|
172 |
np_inpimg = np.array(input_image["image"])
|
173 |
np_inmask = np.array(input_image["mask"]) / 255.0
|