Update model.py
Browse files
model.py
CHANGED
@@ -84,16 +84,18 @@ class Model:
|
|
84 |
delete=False,
|
85 |
mode='w+b')
|
86 |
decode_latent_mesh(self.xm, latent).tri_mesh().write_ply(ply_path)
|
87 |
-
ply_path.close() # Close the file after writing
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
return outputs
|
96 |
|
|
|
|
|
97 |
def run_text(self,
|
98 |
prompt: str,
|
99 |
seed: int = 0,
|
|
|
84 |
delete=False,
|
85 |
mode='w+b')
|
86 |
decode_latent_mesh(self.xm, latent).tri_mesh().write_ply(ply_path)
|
|
|
87 |
|
88 |
+
mesh = trimesh.load(ply_path.name)
|
89 |
+
rot = trimesh.transformations.rotation_matrix(-np.pi / 2, [1, 0, 0])
|
90 |
+
mesh = mesh.apply_transform(rot)
|
91 |
+
rot = trimesh.transformations.rotation_matrix(np.pi, [0, 1, 0])
|
92 |
+
mesh = mesh.apply_transform(rot)
|
93 |
|
94 |
+
mesh_path = tempfile.NamedTemporaryFile(suffix='.glb', delete=False)
|
95 |
+
mesh.export(mesh_path.name, file_type='glb')
|
|
|
96 |
|
97 |
+
return mesh_path.name
|
98 |
+
|
99 |
def run_text(self,
|
100 |
prompt: str,
|
101 |
seed: int = 0,
|