Spaces:
Running
on
Zero
Running
on
Zero
Update infer.py
Browse files
infer.py
CHANGED
|
@@ -64,10 +64,11 @@ def infer_pipe(pipe, test_image, task_name, seed, device, video_depth=False):
|
|
| 64 |
task_emb=task_emb,
|
| 65 |
).images[0]
|
| 66 |
|
| 67 |
-
#
|
| 68 |
if task_name == 'depth':
|
| 69 |
output_npy = pred.mean(axis=-1)
|
| 70 |
-
|
|
|
|
| 71 |
else:
|
| 72 |
output_npy = pred
|
| 73 |
output_color = Image.fromarray((output_npy * 255).astype(np.uint8))
|
|
|
|
| 64 |
task_emb=task_emb,
|
| 65 |
).images[0]
|
| 66 |
|
| 67 |
+
# NEW CODE:
|
| 68 |
if task_name == 'depth':
|
| 69 |
output_npy = pred.mean(axis=-1)
|
| 70 |
+
depth_normalized = ((output_npy - output_npy.min()) / (output_npy.max() - output_npy.min()) * 255).astype(np.uint8)
|
| 71 |
+
output_color = Image.fromarray(depth_normalized, mode='L')
|
| 72 |
else:
|
| 73 |
output_npy = pred
|
| 74 |
output_color = Image.fromarray((output_npy * 255).astype(np.uint8))
|