Spaces:
Sleeping
Sleeping
staswrs
commited on
Commit
·
f2228f5
1
Parent(s):
016e264
clean scene 3
Browse files- app.py +6 -4
- requirements.txt +1 -1
app.py
CHANGED
@@ -21,7 +21,9 @@ import zipfile
|
|
21 |
import requests
|
22 |
import traceback
|
23 |
import trimesh
|
|
|
24 |
from trimesh.exchange.gltf import export_glb
|
|
|
25 |
from inference_triposg import run_triposg
|
26 |
from triposg.pipelines.pipeline_triposg import TripoSGPipeline
|
27 |
from briarmbg import BriaRMBG
|
@@ -123,16 +125,16 @@ def generate(image_path, face_number=50000, guidance_scale=5.0, num_steps=25):
|
|
123 |
mesh.metadata.clear()
|
124 |
mesh.name = "geometry_0"
|
125 |
|
|
|
|
|
|
|
|
|
126 |
# Экспорт .glb вручную (иначе Trimesh добавляет сцену)
|
127 |
# glb_data = mesh.export(file_type="glb")
|
128 |
# with open(output_path, "wb") as f:
|
129 |
# f.write(glb_data)
|
130 |
|
131 |
|
132 |
-
glb_data = export_glb(mesh, include_scene=False)
|
133 |
-
with open(output_path, "wb") as f:
|
134 |
-
f.write(glb_data)
|
135 |
-
|
136 |
print(f"[DEBUG] Mesh saved to {output_path}")
|
137 |
return output_path if os.path.exists(output_path) else None
|
138 |
# except Exception as e:
|
|
|
21 |
import requests
|
22 |
import traceback
|
23 |
import trimesh
|
24 |
+
print("Trimesh version:", trimesh.__version__)
|
25 |
from trimesh.exchange.gltf import export_glb
|
26 |
+
|
27 |
from inference_triposg import run_triposg
|
28 |
from triposg.pipelines.pipeline_triposg import TripoSGPipeline
|
29 |
from briarmbg import BriaRMBG
|
|
|
125 |
mesh.metadata.clear()
|
126 |
mesh.name = "geometry_0"
|
127 |
|
128 |
+
glb_data = export_glb(mesh, include_scene=False)
|
129 |
+
with open(output_path, "wb") as f:
|
130 |
+
f.write(glb_data)
|
131 |
+
|
132 |
# Экспорт .glb вручную (иначе Trimesh добавляет сцену)
|
133 |
# glb_data = mesh.export(file_type="glb")
|
134 |
# with open(output_path, "wb") as f:
|
135 |
# f.write(glb_data)
|
136 |
|
137 |
|
|
|
|
|
|
|
|
|
138 |
print(f"[DEBUG] Mesh saved to {output_path}")
|
139 |
return output_path if os.path.exists(output_path) else None
|
140 |
# except Exception as e:
|
requirements.txt
CHANGED
@@ -2,7 +2,7 @@ gradio
|
|
2 |
torch
|
3 |
torchvision
|
4 |
torchaudio
|
5 |
-
trimesh
|
6 |
pillow
|
7 |
omegaconf
|
8 |
diffusers
|
|
|
2 |
torch
|
3 |
torchvision
|
4 |
torchaudio
|
5 |
+
trimesh==4.1.3
|
6 |
pillow
|
7 |
omegaconf
|
8 |
diffusers
|