Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,11 +50,11 @@ model = model.to(DEVICE).eval()
|
|
| 50 |
title = "# Depth Anything V2"
|
| 51 |
description1 = """Official demo for **Depth Anything V2**.
|
| 52 |
Please refer to our [paper](https://arxiv.org/abs/2406.09414) for more details."""
|
| 53 |
-
description2 = """**Due to the issue with our V2 Github repositories, we temporarily upload the content to [Huggingface space](https://huggingface.co/spaces/depth-anything/Depth-Anything-V2/blob/main/README_Github.md)
|
| 54 |
|
| 55 |
@spaces.GPU
|
| 56 |
def predict_depth(image):
|
| 57 |
-
return model.infer_image(image)
|
| 58 |
|
| 59 |
with gr.Blocks(css=css) as demo:
|
| 60 |
gr.Markdown(title)
|
|
@@ -78,12 +78,12 @@ with gr.Blocks(css=css) as demo:
|
|
| 78 |
|
| 79 |
depth = predict_depth(image[:, :, ::-1])
|
| 80 |
|
| 81 |
-
raw_depth = Image.fromarray(depth.
|
| 82 |
tmp_raw_depth = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
|
| 83 |
raw_depth.save(tmp_raw_depth.name)
|
| 84 |
|
| 85 |
depth = (depth - depth.min()) / (depth.max() - depth.min()) * 255.0
|
| 86 |
-
depth = depth.
|
| 87 |
colored_depth = (cmap(depth)[:, :, :3] * 255).astype(np.uint8)
|
| 88 |
|
| 89 |
gray_depth = Image.fromarray(depth)
|
|
|
|
| 50 |
title = "# Depth Anything V2"
|
| 51 |
description1 = """Official demo for **Depth Anything V2**.
|
| 52 |
Please refer to our [paper](https://arxiv.org/abs/2406.09414) for more details."""
|
| 53 |
+
description2 = """**Due to the issue with our V2 Github repositories, we temporarily upload the content to [Huggingface space](https://huggingface.co/spaces/depth-anything/Depth-Anything-V2/blob/main/README_Github.md).**"""
|
| 54 |
|
| 55 |
@spaces.GPU
|
| 56 |
def predict_depth(image):
|
| 57 |
+
return model.infer_image(image)
|
| 58 |
|
| 59 |
with gr.Blocks(css=css) as demo:
|
| 60 |
gr.Markdown(title)
|
|
|
|
| 78 |
|
| 79 |
depth = predict_depth(image[:, :, ::-1])
|
| 80 |
|
| 81 |
+
raw_depth = Image.fromarray(depth.astype('uint16'))
|
| 82 |
tmp_raw_depth = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
|
| 83 |
raw_depth.save(tmp_raw_depth.name)
|
| 84 |
|
| 85 |
depth = (depth - depth.min()) / (depth.max() - depth.min()) * 255.0
|
| 86 |
+
depth = depth.astype(np.uint8)
|
| 87 |
colored_depth = (cmap(depth)[:, :, :3] * 255).astype(np.uint8)
|
| 88 |
|
| 89 |
gray_depth = Image.fromarray(depth)
|