Spaces:
Sleeping
Sleeping
Move nvdiffrast+diso to runtime install (need nvcc, not available at build time)
Browse files- app.py +20 -0
- requirements.txt +3 -2
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import sys
|
| 2 |
import os
|
|
|
|
| 3 |
import tempfile
|
| 4 |
import shutil
|
| 5 |
import traceback
|
|
@@ -7,6 +8,25 @@ import json
|
|
| 7 |
import random
|
| 8 |
from pathlib import Path
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
import cv2
|
| 11 |
import gradio as gr
|
| 12 |
import spaces
|
|
|
|
| 1 |
import sys
|
| 2 |
import os
|
| 3 |
+
import subprocess
|
| 4 |
import tempfile
|
| 5 |
import shutil
|
| 6 |
import traceback
|
|
|
|
| 8 |
import random
|
| 9 |
from pathlib import Path
|
| 10 |
|
| 11 |
+
# nvdiffrast and diso require CUDA at compile time — install at runtime
|
| 12 |
+
# (ZeroGPU build containers don't have nvcc; runtime containers do)
|
| 13 |
+
def _runtime_install(*packages):
|
| 14 |
+
subprocess.run([sys.executable, "-m", "pip", "install", "--quiet", *packages], check=True)
|
| 15 |
+
|
| 16 |
+
try:
|
| 17 |
+
import nvdiffrast.torch as dr # noqa: F401
|
| 18 |
+
except (ImportError, Exception):
|
| 19 |
+
_runtime_install(
|
| 20 |
+
"nvdiffrast @ git+https://github.com/NVlabs/nvdiffrast.git@253ac4fcea7de5f396371124af597e6cc957bfae"
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
try:
|
| 24 |
+
import diso # noqa: F401
|
| 25 |
+
except (ImportError, Exception):
|
| 26 |
+
_runtime_install(
|
| 27 |
+
"diso @ git+https://github.com/SarahWeiii/diso.git@9792ad928ccb09bdec938779651ee03e395758a6"
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
import cv2
|
| 31 |
import gradio as gr
|
| 32 |
import spaces
|
requirements.txt
CHANGED
|
@@ -8,8 +8,9 @@ clip @ git+https://github.com/openai/CLIP.git@d05afc436d78f1c48dc0dbf8e5980a9d47
|
|
| 8 |
mvadapter @ git+https://github.com/huanngzh/MV-Adapter.git@4277e0018232bac82bb2c103caf0893cedb711be
|
| 9 |
chumpy @ https://huggingface.co/datasets/Daankular/wheels/resolve/main/chumpy-0.71-py3-none-any.whl
|
| 10 |
skel @ git+https://github.com/MarilynKeller/SKEL.git@c32cf16581295bff19399379efe5b776d707cd95
|
| 11 |
-
nvdiffrast
|
| 12 |
-
|
|
|
|
| 13 |
detectron2 @ git+https://github.com/facebookresearch/detectron2.git@8a9d885b3d4dcf1bef015f0593b872ed8d32b4ab
|
| 14 |
|
| 15 |
# Core ML
|
|
|
|
| 8 |
mvadapter @ git+https://github.com/huanngzh/MV-Adapter.git@4277e0018232bac82bb2c103caf0893cedb711be
|
| 9 |
chumpy @ https://huggingface.co/datasets/Daankular/wheels/resolve/main/chumpy-0.71-py3-none-any.whl
|
| 10 |
skel @ git+https://github.com/MarilynKeller/SKEL.git@c32cf16581295bff19399379efe5b776d707cd95
|
| 11 |
+
# nvdiffrast and diso require CUDA (nvcc) at compile time; installed at runtime in app.py
|
| 12 |
+
# nvdiffrast @ git+https://github.com/NVlabs/nvdiffrast.git@253ac4fcea7de5f396371124af597e6cc957bfae
|
| 13 |
+
# diso @ git+https://github.com/SarahWeiii/diso.git@9792ad928ccb09bdec938779651ee03e395758a6
|
| 14 |
detectron2 @ git+https://github.com/facebookresearch/detectron2.git@8a9d885b3d4dcf1bef015f0593b872ed8d32b4ab
|
| 15 |
|
| 16 |
# Core ML
|