Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,7 +38,6 @@ pipe_depth = StableDiffusionControlNetPipeline.from_pretrained(
|
|
| 38 |
# Load a quick, highly accurate MiDaS model pipeline via torch hub
|
| 39 |
midas = torch.hub.load("intel-isl/MiDaS", "MiDaS_small").to(device).eval()
|
| 40 |
midas_transforms = torch.hub.load("intel-isl/MiDaS", "transforms")
|
| 41 |
-
transform_depth = midas_transforms.flag_transform if hasattr(midas_transforms, 'flag_transform') else midas_transforms.dpt_transform
|
| 42 |
|
| 43 |
|
| 44 |
@spaces.GPU
|
|
@@ -121,6 +120,7 @@ def extract_depth_map(image_path):
|
|
| 121 |
"""
|
| 122 |
Utilizes a lightweight MiDaS pipeline to extract depth estimation layouts.
|
| 123 |
"""
|
|
|
|
| 124 |
|
| 125 |
pil_image = Image.open(image_path).convert("RGB")
|
| 126 |
cv_img = np.array(pil_image)
|
|
|
|
| 38 |
# Load a quick, highly accurate MiDaS model pipeline via torch hub
|
| 39 |
midas = torch.hub.load("intel-isl/MiDaS", "MiDaS_small").to(device).eval()
|
| 40 |
midas_transforms = torch.hub.load("intel-isl/MiDaS", "transforms")
|
|
|
|
| 41 |
|
| 42 |
|
| 43 |
@spaces.GPU
|
|
|
|
| 120 |
"""
|
| 121 |
Utilizes a lightweight MiDaS pipeline to extract depth estimation layouts.
|
| 122 |
"""
|
| 123 |
+
transform_depth = midas_transforms.flag_transform if hasattr(midas_transforms, 'flag_transform') else midas_transforms.dpt_transform
|
| 124 |
|
| 125 |
pil_image = Image.open(image_path).convert("RGB")
|
| 126 |
cv_img = np.array(pil_image)
|