Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ from gradio_imageslider import ImageSlider
|
|
13 |
from huggingface_hub import hf_hub_download
|
14 |
from safetensors.torch import load_file
|
15 |
from transformers import pipeline
|
16 |
-
|
17 |
from depth_anything_v2.dpt import DepthAnythingV2
|
18 |
|
19 |
css = """
|
@@ -81,9 +81,12 @@ with gr.Blocks(css=css) as demo:
|
|
81 |
cmap = matplotlib.colormaps.get_cmap('Spectral_r')
|
82 |
|
83 |
def on_submit(image):
|
|
|
|
|
|
|
84 |
original_image = image.copy()
|
85 |
|
86 |
-
h, w = image.shape
|
87 |
|
88 |
depth = predict_depth(image)
|
89 |
|
|
|
13 |
from huggingface_hub import hf_hub_download
|
14 |
from safetensors.torch import load_file
|
15 |
from transformers import pipeline
|
16 |
+
from PIL import Image
|
17 |
from depth_anything_v2.dpt import DepthAnythingV2
|
18 |
|
19 |
css = """
|
|
|
81 |
cmap = matplotlib.colormaps.get_cmap('Spectral_r')
|
82 |
|
83 |
def on_submit(image):
|
84 |
+
if isinstance(image, np.ndarray):
|
85 |
+
image = Image.fromarray(image)
|
86 |
+
|
87 |
original_image = image.copy()
|
88 |
|
89 |
+
h, w = image.size # For PIL images, use .size instead of .shape
|
90 |
|
91 |
depth = predict_depth(image)
|
92 |
|