Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
b5813c5
1
Parent(s):
46dbd5a
Refactor import paths and update requirements for Depth-Anything-3
Browse files- Depth-Anything-3-anysize/app.py +7 -0
- Depth-Anything-3-anysize/depth3_anysize.py +7 -0
- Depth-Anything-3-anysize/requirements.txt +3 -2
- pyproject.toml +0 -93
- requirements.txt +22 -8
Depth-Anything-3-anysize/app.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
|
|
|
|
|
|
| 3 |
from typing import Dict, Optional, Tuple
|
| 4 |
|
| 5 |
import gradio as gr
|
|
@@ -7,6 +9,11 @@ import numpy as np
|
|
| 7 |
import torch
|
| 8 |
from PIL import Image
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
from depth_anything_3.api import DepthAnything3
|
| 11 |
from depth_anything_3.utils.visualize import visualize_depth
|
| 12 |
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
+
import os
|
| 4 |
+
import sys
|
| 5 |
from typing import Dict, Optional, Tuple
|
| 6 |
|
| 7 |
import gradio as gr
|
|
|
|
| 9 |
import torch
|
| 10 |
from PIL import Image
|
| 11 |
|
| 12 |
+
# Add src directory to Python path to import depth_anything_3 module
|
| 13 |
+
src_path = os.path.join(os.path.dirname(__file__), 'src')
|
| 14 |
+
if src_path not in sys.path:
|
| 15 |
+
sys.path.insert(0, src_path)
|
| 16 |
+
|
| 17 |
from depth_anything_3.api import DepthAnything3
|
| 18 |
from depth_anything_3.utils.visualize import visualize_depth
|
| 19 |
|
Depth-Anything-3-anysize/depth3_anysize.py
CHANGED
|
@@ -1,8 +1,15 @@
|
|
| 1 |
import os
|
|
|
|
| 2 |
import numpy as np
|
| 3 |
import matplotlib.pyplot as plt
|
| 4 |
from PIL import Image
|
| 5 |
import torch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
from depth_anything_3.api import DepthAnything3
|
| 7 |
from depth_anything_3.utils.visualize import visualize_depth
|
| 8 |
|
|
|
|
| 1 |
import os
|
| 2 |
+
import sys
|
| 3 |
import numpy as np
|
| 4 |
import matplotlib.pyplot as plt
|
| 5 |
from PIL import Image
|
| 6 |
import torch
|
| 7 |
+
|
| 8 |
+
# Add src directory to Python path to import depth_anything_3 module
|
| 9 |
+
src_path = os.path.join(os.path.dirname(__file__), 'src')
|
| 10 |
+
if src_path not in sys.path:
|
| 11 |
+
sys.path.insert(0, src_path)
|
| 12 |
+
|
| 13 |
from depth_anything_3.api import DepthAnything3
|
| 14 |
from depth_anything_3.utils.visualize import visualize_depth
|
| 15 |
|
Depth-Anything-3-anysize/requirements.txt
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
torchvision
|
| 2 |
einops
|
| 3 |
huggingface_hub
|
|
@@ -13,7 +14,6 @@ plyfile
|
|
| 13 |
pillow_heif
|
| 14 |
safetensors
|
| 15 |
pycolmap
|
| 16 |
-
torch>=2
|
| 17 |
uvicorn
|
| 18 |
typer>=0.9.0
|
| 19 |
pillow
|
|
@@ -21,4 +21,5 @@ pre-commit
|
|
| 21 |
trimesh
|
| 22 |
numpy<2
|
| 23 |
omegaconf
|
| 24 |
-
|
|
|
|
|
|
| 1 |
+
torch>=2
|
| 2 |
torchvision
|
| 3 |
einops
|
| 4 |
huggingface_hub
|
|
|
|
| 14 |
pillow_heif
|
| 15 |
safetensors
|
| 16 |
pycolmap
|
|
|
|
| 17 |
uvicorn
|
| 18 |
typer>=0.9.0
|
| 19 |
pillow
|
|
|
|
| 21 |
trimesh
|
| 22 |
numpy<2
|
| 23 |
omegaconf
|
| 24 |
+
gradio>=5
|
| 25 |
+
gsplat @ git+https://github.com/nerfstudio-project/gsplat.git@0b4dddf04cb687367602c01196913cde6a743d70
|
pyproject.toml
DELETED
|
@@ -1,93 +0,0 @@
|
|
| 1 |
-
[build-system]
|
| 2 |
-
requires = ["hatchling>=1.25", "hatch-vcs>=0.4"]
|
| 3 |
-
build-backend = "hatchling.build"
|
| 4 |
-
|
| 5 |
-
[project]
|
| 6 |
-
name = "depth-anything-3"
|
| 7 |
-
version = "0.0.0"
|
| 8 |
-
description = "Depth Anything 3"
|
| 9 |
-
readme = "README.md"
|
| 10 |
-
requires-python = ">=3.9, <=3.13"
|
| 11 |
-
license = { text = "Apache-2.0" }
|
| 12 |
-
authors = [{ name = "Your Name" }]
|
| 13 |
-
|
| 14 |
-
dependencies = [
|
| 15 |
-
"pre-commit",
|
| 16 |
-
"trimesh",
|
| 17 |
-
"torch>=2",
|
| 18 |
-
"torchvision",
|
| 19 |
-
"einops",
|
| 20 |
-
"huggingface_hub",
|
| 21 |
-
"imageio",
|
| 22 |
-
"numpy<2",
|
| 23 |
-
"opencv-python",
|
| 24 |
-
"open3d",
|
| 25 |
-
"fastapi",
|
| 26 |
-
"uvicorn",
|
| 27 |
-
"requests",
|
| 28 |
-
"typer",
|
| 29 |
-
"pillow",
|
| 30 |
-
"omegaconf",
|
| 31 |
-
"evo",
|
| 32 |
-
"e3nn",
|
| 33 |
-
"moviepy",
|
| 34 |
-
"plyfile",
|
| 35 |
-
"pillow_heif",
|
| 36 |
-
"safetensors",
|
| 37 |
-
"uvicorn",
|
| 38 |
-
"moviepy==1.0.3",
|
| 39 |
-
"typer>=0.9.0",
|
| 40 |
-
"pycolmap",
|
| 41 |
-
]
|
| 42 |
-
|
| 43 |
-
[project.optional-dependencies]
|
| 44 |
-
app = ["gradio>=5", "pillow>=9.0"] # requires that python3>=3.10
|
| 45 |
-
gs = ["gsplat @ git+https://github.com/nerfstudio-project/gsplat.git@0b4dddf04cb687367602c01196913cde6a743d70"]
|
| 46 |
-
all = ["depth-anything-3[app,gs]"]
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
[project.scripts]
|
| 50 |
-
da3 = "depth_anything_3.cli:app"
|
| 51 |
-
|
| 52 |
-
[project.urls]
|
| 53 |
-
Homepage = "https://github.com/ByteDance-Seed/Depth-Anything-3"
|
| 54 |
-
|
| 55 |
-
[tool.hatch.version]
|
| 56 |
-
source = "vcs"
|
| 57 |
-
|
| 58 |
-
[tool.hatch.build.targets.wheel]
|
| 59 |
-
packages = ["src/depth_anything_3"]
|
| 60 |
-
|
| 61 |
-
[tool.hatch.build.targets.sdist]
|
| 62 |
-
include = [
|
| 63 |
-
"Depth-Anything-3-anysize/README.md",
|
| 64 |
-
"Depth-Anything-3-anysize/pyproject.toml",
|
| 65 |
-
"Depth-Anything-3-anysize/src/depth_anything_3",
|
| 66 |
-
]
|
| 67 |
-
|
| 68 |
-
[tool.hatch.metadata]
|
| 69 |
-
allow-direct-references = true
|
| 70 |
-
|
| 71 |
-
[tool.mypy]
|
| 72 |
-
plugins = ["jaxtyping.mypy_plugin"]
|
| 73 |
-
|
| 74 |
-
[tool.black]
|
| 75 |
-
line-length = 99
|
| 76 |
-
target-version = ['py37', 'py38', 'py39', 'py310', 'py311']
|
| 77 |
-
include = '\.pyi?$'
|
| 78 |
-
exclude = '''
|
| 79 |
-
/(
|
| 80 |
-
| \.git
|
| 81 |
-
)/
|
| 82 |
-
'''
|
| 83 |
-
|
| 84 |
-
[tool.isort]
|
| 85 |
-
profile = "black"
|
| 86 |
-
multi_line_output = 3
|
| 87 |
-
include_trailing_comma = true
|
| 88 |
-
known_third_party = ["bson","cruise","cv2","dataloader","diffusers","omegaconf","tensorflow","torch","torchvision","transformers","gsplat"]
|
| 89 |
-
known_first_party = ["common", "data", "models", "projects"]
|
| 90 |
-
sections = ["FUTURE","STDLIB","THIRDPARTY","FIRSTPARTY","LOCALFOLDER"]
|
| 91 |
-
skip_gitignore = true
|
| 92 |
-
line_length = 99
|
| 93 |
-
no_lines_before="THIRDPARTY"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
|
@@ -1,18 +1,32 @@
|
|
| 1 |
-
gradio>=4.0.0
|
| 2 |
torch>=2.0.0
|
| 3 |
torchvision>=0.15.0
|
| 4 |
-
|
| 5 |
-
numpy>=1.24.0
|
| 6 |
pillow>=9.5.0
|
|
|
|
| 7 |
matplotlib>=3.7.0
|
|
|
|
|
|
|
| 8 |
huggingface-hub>=0.16.0
|
| 9 |
-
spaces>=0.25.0
|
| 10 |
transformers>=4.30.0
|
| 11 |
timm>=0.9.0
|
| 12 |
-
|
|
|
|
|
|
|
| 13 |
open3d
|
| 14 |
scikit-learn
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
git+https://github.com/EasternJournalist/utils3d.git@c5daf6f6c244d251f252102d09e9b7bcef791a38
|
| 16 |
-
click # ==8.1.7
|
| 17 |
-
trimesh # ==4.5.1
|
| 18 |
-
.[all]
|
|
|
|
|
|
|
| 1 |
torch>=2.0.0
|
| 2 |
torchvision>=0.15.0
|
| 3 |
+
numpy<2
|
|
|
|
| 4 |
pillow>=9.5.0
|
| 5 |
+
opencv-python>=4.8.0
|
| 6 |
matplotlib>=3.7.0
|
| 7 |
+
gradio>=5
|
| 8 |
+
gradio_imageslider
|
| 9 |
huggingface-hub>=0.16.0
|
|
|
|
| 10 |
transformers>=4.30.0
|
| 11 |
timm>=0.9.0
|
| 12 |
+
spaces>=0.25.0
|
| 13 |
+
einops
|
| 14 |
+
imageio
|
| 15 |
open3d
|
| 16 |
scikit-learn
|
| 17 |
+
trimesh
|
| 18 |
+
click
|
| 19 |
+
fastapi
|
| 20 |
+
uvicorn
|
| 21 |
+
requests
|
| 22 |
+
evo
|
| 23 |
+
e3nn
|
| 24 |
+
moviepy==1.0.3
|
| 25 |
+
plyfile
|
| 26 |
+
pillow_heif
|
| 27 |
+
safetensors
|
| 28 |
+
pycolmap
|
| 29 |
+
typer>=0.9.0
|
| 30 |
+
pre-commit
|
| 31 |
+
omegaconf
|
| 32 |
git+https://github.com/EasternJournalist/utils3d.git@c5daf6f6c244d251f252102d09e9b7bcef791a38
|
|
|
|
|
|
|
|
|