Spaces:
Runtime error
Runtime error
Commit
·
705bafd
1
Parent(s):
ad32b78
Update app.py
Browse files
app.py
CHANGED
@@ -91,7 +91,7 @@ def predict_images(dict, depth, prompt="", negative_prompt="", guidance_scale=7.
|
|
91 |
if negative_prompt == "":
|
92 |
negative_prompt = None
|
93 |
|
94 |
-
og_size = dict["image"].shape[
|
95 |
|
96 |
init_image = cv2.resize(dict["image"], (512, 512))
|
97 |
|
@@ -201,6 +201,7 @@ def predict_images_3d(dict, depth, prompt="", negative_prompt="", guidance_scale
|
|
201 |
if negative_prompt == "":
|
202 |
negative_prompt = None
|
203 |
|
|
|
204 |
init_image = cv2.resize(dict["image"], (512, 512))
|
205 |
|
206 |
mask = Image.fromarray(cv2.resize(dict["mask"], (512, 512))[:,:,0])
|
@@ -221,8 +222,12 @@ def predict_images_3d(dict, depth, prompt="", negative_prompt="", guidance_scale
|
|
221 |
|
222 |
output = pipe(prompt = prompt, negative_prompt=negative_prompt, image=init_image, mask_image=mask, depth_image=depth_image, guidance_scale=guidance_scale, num_inference_steps=int(steps), strength=strength)
|
223 |
|
|
|
|
|
|
|
|
|
224 |
depth_in = denormalize(np.array(depth_image), min, max)
|
225 |
-
depth_out = denormalize(np.array(
|
226 |
|
227 |
output_image = output.rgb[0]
|
228 |
|
|
|
91 |
if negative_prompt == "":
|
92 |
negative_prompt = None
|
93 |
|
94 |
+
og_size = (dict["image"].shape[1], dict["image"].shape[0])
|
95 |
|
96 |
init_image = cv2.resize(dict["image"], (512, 512))
|
97 |
|
|
|
201 |
if negative_prompt == "":
|
202 |
negative_prompt = None
|
203 |
|
204 |
+
og_size = (dict["image"].shape[1], dict["image"].shape[0])
|
205 |
init_image = cv2.resize(dict["image"], (512, 512))
|
206 |
|
207 |
mask = Image.fromarray(cv2.resize(dict["mask"], (512, 512))[:,:,0])
|
|
|
222 |
|
223 |
output = pipe(prompt = prompt, negative_prompt=negative_prompt, image=init_image, mask_image=mask, depth_image=depth_image, guidance_scale=guidance_scale, num_inference_steps=int(steps), strength=strength)
|
224 |
|
225 |
+
# resize to original size
|
226 |
+
depth_image = depth_image.resize(og_size)
|
227 |
+
output_depth = output.depth[0].resize(og_size)
|
228 |
+
|
229 |
depth_in = denormalize(np.array(depth_image), min, max)
|
230 |
+
depth_out = denormalize(np.array(output_depth), min, max)
|
231 |
|
232 |
output_image = output.rgb[0]
|
233 |
|