Commit
·
38a574e
1
Parent(s):
77834ec
fix lfs download at runtime
Browse files- .gitattributes +2 -0
- enhanced_app.py +22 -0
.gitattributes
CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
37 |
+
*.ply filter=lfs diff=lfs merge=lfs -text
|
enhanced_app.py
CHANGED
@@ -43,6 +43,7 @@ import plotly.graph_objects as go
|
|
43 |
import plotly.io as pio
|
44 |
import open3d as o3d
|
45 |
import json
|
|
|
46 |
|
47 |
# Import DepthAnythingV2 (assuming it's in the same directory or installed)
|
48 |
try:
|
@@ -59,6 +60,24 @@ os.environ['XFORMERS_MORE_DETAILS'] = '1'
|
|
59 |
# Output directory structure (mounted volume)
|
60 |
OUTPUT_DIR = Path("outputs")
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
# =============================================================================
|
63 |
# Model Base Classes and Configurations
|
64 |
# =============================================================================
|
@@ -80,6 +99,8 @@ class DepthConfig:
|
|
80 |
max_depth: int = 80 # 20 for indoor, 80 for outdoor
|
81 |
weights_path: str = "depth_anything_v2_metric_vkitti_vitl.pth"
|
82 |
device: str = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
|
83 |
|
84 |
class BaseSegmentationModel(ABC):
|
85 |
"""Abstract base class for segmentation models."""
|
@@ -938,6 +959,7 @@ def create_gradio_interface():
|
|
938 |
# =============================================================================
|
939 |
|
940 |
if __name__ == "__main__":
|
|
|
941 |
# Create and launch the interface
|
942 |
demo = create_gradio_interface()
|
943 |
|
|
|
43 |
import plotly.io as pio
|
44 |
import open3d as o3d
|
45 |
import json
|
46 |
+
import subprocess
|
47 |
|
48 |
# Import DepthAnythingV2 (assuming it's in the same directory or installed)
|
49 |
try:
|
|
|
60 |
# Output directory structure (mounted volume)
|
61 |
OUTPUT_DIR = Path("outputs")
|
62 |
|
63 |
+
def fix_lfs_on_startup():
|
64 |
+
"""Quick fix for LFS issues on HuggingFace startup."""
|
65 |
+
print("������ Checking for LFS issues...")
|
66 |
+
|
67 |
+
try:
|
68 |
+
# Try to pull LFS files
|
69 |
+
result = subprocess.run(['git', 'lfs', 'pull'],
|
70 |
+
capture_output=True, text=True, timeout=30)
|
71 |
+
if result.returncode == 0:
|
72 |
+
print("✅ LFS files pulled successfully")
|
73 |
+
else:
|
74 |
+
print(f"⚠️ LFS pull failed: {result.stderr}")
|
75 |
+
# Try checkout instead
|
76 |
+
subprocess.run(['git', 'lfs', 'checkout'],
|
77 |
+
capture_output=True, timeout=20)
|
78 |
+
except Exception as e:
|
79 |
+
print(f"⚠️ LFS operations failed: {e}")
|
80 |
+
|
81 |
# =============================================================================
|
82 |
# Model Base Classes and Configurations
|
83 |
# =============================================================================
|
|
|
99 |
max_depth: int = 80 # 20 for indoor, 80 for outdoor
|
100 |
weights_path: str = "depth_anything_v2_metric_vkitti_vitl.pth"
|
101 |
device: str = "cuda" if torch.cuda.is_available() else "cpu"
|
102 |
+
|
103 |
+
|
104 |
|
105 |
class BaseSegmentationModel(ABC):
|
106 |
"""Abstract base class for segmentation models."""
|
|
|
959 |
# =============================================================================
|
960 |
|
961 |
if __name__ == "__main__":
|
962 |
+
fix_lfs_on_startup()
|
963 |
# Create and launch the interface
|
964 |
demo = create_gradio_interface()
|
965 |
|