Spaces:
Running on Zero
Running on Zero
Umut Kocasari Claude Opus 4.8 commited on
Commit ·
6d76d9e
1
Parent(s): fe4c53e
Fix missing model deps on the Space (lazy export + addict/evo)
Browse filesdepth_anything_3.api imported the whole utils.export chain at module top, pulling
moviepy (export-only, not installed) and crashing load_model. Make that import
lazy (only when export_dir is set, which the demo never does). The remaining core
imports need addict (config dicts in registry/model heads) and evo (pose_align
PosePath3D), which were missing from requirements — add them (pinned to the
known-good versions). Verified by tracing a real load_model+inference run against
this exact code: full pipeline completes, all outputs produced.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- requirements.txt +2 -0
- src/depth_anything_3/api.py +5 -1
requirements.txt
CHANGED
|
@@ -16,6 +16,8 @@ einops==0.8.1
|
|
| 16 |
omegaconf==2.3.0
|
| 17 |
safetensors==0.7.0
|
| 18 |
e3nn==0.5.8
|
|
|
|
|
|
|
| 19 |
|
| 20 |
opencv-python-headless==4.11.0.86
|
| 21 |
pillow
|
|
|
|
| 16 |
omegaconf==2.3.0
|
| 17 |
safetensors==0.7.0
|
| 18 |
e3nn==0.5.8
|
| 19 |
+
addict==2.4.0 # depth_anything_3 config dicts (registry / model heads)
|
| 20 |
+
evo==1.34.0 # depth_anything_3.utils.pose_align (PosePath3D)
|
| 21 |
|
| 22 |
opencv-python-headless==4.11.0.86
|
| 23 |
pillow
|
src/depth_anything_3/api.py
CHANGED
|
@@ -31,7 +31,6 @@ from PIL import Image
|
|
| 31 |
from depth_anything_3.cfg import create_object, load_config
|
| 32 |
from depth_anything_3.registry import MODEL_REGISTRY
|
| 33 |
from depth_anything_3.specs import Prediction
|
| 34 |
-
from depth_anything_3.utils.export import export
|
| 35 |
from depth_anything_3.utils.geometry import affine_inverse
|
| 36 |
from depth_anything_3.utils.io.input_processor import InputProcessor
|
| 37 |
from depth_anything_3.utils.io.output_processor import OutputProcessor
|
|
@@ -417,6 +416,11 @@ class DepthAnything3(nn.Module, PyTorchModelHubMixin):
|
|
| 417 |
self, prediction: Prediction, export_format: str, export_dir: str, **kwargs
|
| 418 |
) -> None:
|
| 419 |
"""Export results to specified format and directory."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 420 |
start_time = time.time()
|
| 421 |
export(prediction, export_format, export_dir, **kwargs)
|
| 422 |
end_time = time.time()
|
|
|
|
| 31 |
from depth_anything_3.cfg import create_object, load_config
|
| 32 |
from depth_anything_3.registry import MODEL_REGISTRY
|
| 33 |
from depth_anything_3.specs import Prediction
|
|
|
|
| 34 |
from depth_anything_3.utils.geometry import affine_inverse
|
| 35 |
from depth_anything_3.utils.io.input_processor import InputProcessor
|
| 36 |
from depth_anything_3.utils.io.output_processor import OutputProcessor
|
|
|
|
| 416 |
self, prediction: Prediction, export_format: str, export_dir: str, **kwargs
|
| 417 |
) -> None:
|
| 418 |
"""Export results to specified format and directory."""
|
| 419 |
+
# Lazy import: the export chain pulls heavy, export-only deps (moviepy,
|
| 420 |
+
# etc.) that the inference/demo path never needs. Only import when an
|
| 421 |
+
# export is actually requested (export_dir set).
|
| 422 |
+
from depth_anything_3.utils.export import export
|
| 423 |
+
|
| 424 |
start_time = time.time()
|
| 425 |
export(prediction, export_format, export_dir, **kwargs)
|
| 426 |
end_time = time.time()
|