Spaces:
Running on Zero
Running on Zero
Fix triposg: clone source at runtime (no setup.py); remove bad pip install attempt
Browse files- app.py +14 -17
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -160,18 +160,21 @@ def load_triposg():
|
|
| 160 |
|
| 161 |
print("[load_triposg] Loading TripoSG pipeline...")
|
| 162 |
from huggingface_hub import snapshot_download
|
| 163 |
-
weights_path = snapshot_download("VAST-AI/TripoSG")
|
| 164 |
|
| 165 |
-
# TripoSG
|
| 166 |
-
|
| 167 |
-
if
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
|
| 176 |
from triposg.pipelines.pipeline_triposg import TripoSGPipeline
|
| 177 |
_triposg_pipe = TripoSGPipeline.from_pretrained(
|
|
@@ -250,12 +253,6 @@ def generate_shape(input_image, remove_background, num_steps, guidance_scale,
|
|
| 250 |
return None, "Please upload an image."
|
| 251 |
try:
|
| 252 |
progress(0.1, desc="Loading TripoSG...")
|
| 253 |
-
|
| 254 |
-
# Add TripoSG scripts to path after model download
|
| 255 |
-
from huggingface_hub import snapshot_download
|
| 256 |
-
weights_path = snapshot_download("VAST-AI/TripoSG")
|
| 257 |
-
sys.path.insert(0, weights_path)
|
| 258 |
-
|
| 259 |
pipe, rmbg_net = load_triposg()
|
| 260 |
|
| 261 |
img = Image.fromarray(input_image).convert("RGB")
|
|
|
|
| 160 |
|
| 161 |
print("[load_triposg] Loading TripoSG pipeline...")
|
| 162 |
from huggingface_hub import snapshot_download
|
|
|
|
| 163 |
|
| 164 |
+
# TripoSG source has no setup.py — clone GitHub repo and add to sys.path
|
| 165 |
+
triposg_src = Path("/tmp/triposg-src")
|
| 166 |
+
if not triposg_src.exists():
|
| 167 |
+
print("[load_triposg] Cloning TripoSG source...")
|
| 168 |
+
subprocess.run(
|
| 169 |
+
["git", "clone", "--depth=1",
|
| 170 |
+
"https://github.com/VAST-AI-Research/TripoSG.git",
|
| 171 |
+
str(triposg_src)],
|
| 172 |
+
check=True
|
| 173 |
+
)
|
| 174 |
+
if str(triposg_src) not in sys.path:
|
| 175 |
+
sys.path.insert(0, str(triposg_src))
|
| 176 |
+
|
| 177 |
+
weights_path = snapshot_download("VAST-AI/TripoSG")
|
| 178 |
|
| 179 |
from triposg.pipelines.pipeline_triposg import TripoSGPipeline
|
| 180 |
_triposg_pipe = TripoSGPipeline.from_pretrained(
|
|
|
|
| 253 |
return None, "Please upload an image."
|
| 254 |
try:
|
| 255 |
progress(0.1, desc="Loading TripoSG...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 256 |
pipe, rmbg_net = load_triposg()
|
| 257 |
|
| 258 |
img = Image.fromarray(input_image).convert("RGB")
|
requirements.txt
CHANGED
|
@@ -10,7 +10,7 @@ numpy>=2
|
|
| 10 |
# in pip>=21 isolated builds. Fix: --no-build-isolation at runtime.
|
| 11 |
# - nvdiffrast/diso/detectron2 require nvcc (NVIDIA CUDA compiler) which is only
|
| 12 |
# available in the ZeroGPU runtime container, not the Docker build stage.
|
| 13 |
-
triposg
|
| 14 |
clip @ git+https://github.com/openai/CLIP.git@d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
|
| 15 |
# mvadapter and stablenormal use over-pinned deps (opencv-python vs headless, diffusers==0.28.0)
|
| 16 |
# installed at runtime with --no-deps in app.py
|
|
|
|
| 10 |
# in pip>=21 isolated builds. Fix: --no-build-isolation at runtime.
|
| 11 |
# - nvdiffrast/diso/detectron2 require nvcc (NVIDIA CUDA compiler) which is only
|
| 12 |
# available in the ZeroGPU runtime container, not the Docker build stage.
|
| 13 |
+
# triposg has no setup.py — cloned at runtime in app.py and added to sys.path
|
| 14 |
clip @ git+https://github.com/openai/CLIP.git@d05afc436d78f1c48dc0dbf8e5980a9d471f35f6
|
| 15 |
# mvadapter and stablenormal use over-pinned deps (opencv-python vs headless, diffusers==0.28.0)
|
| 16 |
# installed at runtime with --no-deps in app.py
|