pablo commited on
Commit
f2d65f6
·
1 Parent(s): 0de5570

int32 depth

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -51,9 +51,9 @@ def estimate_depth(image):
51
 
52
  output = prediction.cpu().numpy()
53
 
54
- output= 255 * (output - np.min(output))/(np.max(output) - np.min(output))
55
 
56
- return Image.fromarray(output.astype("uint8"))
57
 
58
 
59
  def read_content(file_path: str) -> str:
@@ -78,8 +78,10 @@ def predict(dict, depth, prompt="", negative_prompt="", guidance_scale=7.5, step
78
  depth_image = estimate_depth(init_image)
79
 
80
  else:
81
- depth_image = depth
82
- depth_image = Image.fromarray(depth_image[:,:,0].astype("uint8"))
 
 
83
 
84
  init_image = Image.fromarray(init_image.astype("uint8"))
85
  init_image.save("temp_image.jpg")
 
51
 
52
  output = prediction.cpu().numpy()
53
 
54
+ output= 65535 * (output - np.min(output))/(np.max(output) - np.min(output))
55
 
56
+ return Image.fromarray(output.astype("int32"))
57
 
58
 
59
  def read_content(file_path: str) -> str:
 
78
  depth_image = estimate_depth(init_image)
79
 
80
  else:
81
+ d_i = depth[:,:,0]
82
+ depth_image = 65535 * (d_i - np.min(d_i))/(np.max(d_i) - np.min(d_i))
83
+ depth_image = depth_image.astype("int32")
84
+ depth_image = Image.fromarray(depth_image)
85
 
86
  init_image = Image.fromarray(init_image.astype("uint8"))
87
  init_image.save("temp_image.jpg")