aknoerig commited on
Commit
486a7bf
·
1 Parent(s): fb49ce5

Fix custom depth image

Browse files

Currently the custom depth image is not working: it's not in the right format, and is supplied with an unknown argument (`depth`), and thus silently fails.
This was hard to catch, as the auto-generated depth map works so well.

Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -36,8 +36,8 @@ def predict(input_image, prompt, negative_prompt, steps, num_samples, scale, see
36
  depth_image = pad_image(depth_image)
37
  depth_image = depth_image.resize((512, 512))
38
  depth = np.array(depth_image.convert("L"))
 
39
  depth = depth.astype(np.float32) / 255.0
40
- depth = depth[None, None]
41
  depth = torch.from_numpy(depth)
42
  init_image = input_image.convert("RGB")
43
  image = pad_image(init_image) # resize to integer multiple of 32
@@ -46,7 +46,7 @@ def predict(input_image, prompt, negative_prompt, steps, num_samples, scale, see
46
  image=image,
47
  prompt=prompt,
48
  negative_prompt=negative_prompt,
49
- depth_image=depth,
50
  seed=seed,
51
  strength=strength,
52
  num_inference_steps=steps,
 
36
  depth_image = pad_image(depth_image)
37
  depth_image = depth_image.resize((512, 512))
38
  depth = np.array(depth_image.convert("L"))
39
+ depth = np.expand_dims(depth, 0)
40
  depth = depth.astype(np.float32) / 255.0
 
41
  depth = torch.from_numpy(depth)
42
  init_image = input_image.convert("RGB")
43
  image = pad_image(init_image) # resize to integer multiple of 32
 
46
  image=image,
47
  prompt=prompt,
48
  negative_prompt=negative_prompt,
49
+ depth_map=depth,
50
  seed=seed,
51
  strength=strength,
52
  num_inference_steps=steps,