Spaces:
Running on Zero
Running on Zero
Fix o_voxel import: monkey-patch postprocess instead of sys.path override
Browse files
app.py
CHANGED
|
@@ -6,9 +6,7 @@ from concurrent.futures import ThreadPoolExecutor
|
|
| 6 |
import os
|
| 7 |
import sys
|
| 8 |
|
| 9 |
-
# Prioritize local o-voxel submodule (with cumesh.fill_holes() fix) over prebuilt wheel
|
| 10 |
_script_dir = os.path.dirname(os.path.abspath(__file__))
|
| 11 |
-
sys.path.insert(0, os.path.join(_script_dir, 'o-voxel'))
|
| 12 |
|
| 13 |
os.environ["OPENCV_IO_ENABLE_OPENEXR"] = '1'
|
| 14 |
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "expandable_segments:True"
|
|
@@ -31,6 +29,16 @@ from trellis2.renderers import EnvMap
|
|
| 31 |
from trellis2.utils import render_utils
|
| 32 |
import o_voxel
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
MAX_SEED = np.iinfo(np.int32).max
|
| 36 |
TMP_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tmp')
|
|
|
|
| 6 |
import os
|
| 7 |
import sys
|
| 8 |
|
|
|
|
| 9 |
_script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
| 10 |
|
| 11 |
os.environ["OPENCV_IO_ENABLE_OPENEXR"] = '1'
|
| 12 |
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "expandable_segments:True"
|
|
|
|
| 29 |
from trellis2.utils import render_utils
|
| 30 |
import o_voxel
|
| 31 |
|
| 32 |
+
# Patch postprocess module with local fix for cumesh.fill_holes() bug
|
| 33 |
+
import importlib.util
|
| 34 |
+
_local_postprocess = os.path.join(_script_dir, 'o-voxel', 'o_voxel', 'postprocess.py')
|
| 35 |
+
if os.path.exists(_local_postprocess):
|
| 36 |
+
_spec = importlib.util.spec_from_file_location('o_voxel.postprocess', _local_postprocess)
|
| 37 |
+
_mod = importlib.util.module_from_spec(_spec)
|
| 38 |
+
_spec.loader.exec_module(_mod)
|
| 39 |
+
o_voxel.postprocess = _mod
|
| 40 |
+
sys.modules['o_voxel.postprocess'] = _mod
|
| 41 |
+
|
| 42 |
|
| 43 |
MAX_SEED = np.iinfo(np.int32).max
|
| 44 |
TMP_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tmp')
|