Spaces:
Runtime error
Runtime error
pablo
commited on
Commit
·
670957e
1
Parent(s):
86568de
neeew
Browse files
app.py
CHANGED
@@ -69,7 +69,7 @@ def predict(dict, depth, prompt="", negative_prompt="", guidance_scale=7.5, step
|
|
69 |
negative_prompt = None
|
70 |
scheduler_class_name = scheduler.split("-")[0]
|
71 |
|
72 |
-
init_image = cv2.
|
73 |
|
74 |
mask = Image.fromarray(cv2.resize(dict["mask"], (512, 512))[:,:,0])
|
75 |
mask.save("temp_mask.jpg")
|
@@ -93,7 +93,11 @@ def predict(dict, depth, prompt="", negative_prompt="", guidance_scale=7.5, step
|
|
93 |
|
94 |
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)
|
95 |
|
96 |
-
|
|
|
|
|
|
|
|
|
97 |
|
98 |
|
99 |
css = '''
|
|
|
69 |
negative_prompt = None
|
70 |
scheduler_class_name = scheduler.split("-")[0]
|
71 |
|
72 |
+
init_image = cv2.resize(dict["image"], (512, 512))
|
73 |
|
74 |
mask = Image.fromarray(cv2.resize(dict["mask"], (512, 512))[:,:,0])
|
75 |
mask.save("temp_mask.jpg")
|
|
|
93 |
|
94 |
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)
|
95 |
|
96 |
+
output_depth_vis = (output.depth[0] - np.min(output.depth[0])) / (np.max(output.depth[0]) - np.min(output.depth[0])) * 255
|
97 |
+
output_depth_vis = output_depth_vis.astype("uint8")
|
98 |
+
output_depth = Image.fromarray(output_depth_vis)
|
99 |
+
|
100 |
+
return output.rgb[0], output_depth, gr.update(visible=True)
|
101 |
|
102 |
|
103 |
css = '''
|