Spaces:
Running
on
Zero
Running
on
Zero
- app.py +4 -4
- trellis/pipelines/trellis_text_to_3d.py +0 -5
app.py
CHANGED
@@ -120,11 +120,11 @@ def text_to_3d(
|
|
120 |
"cfg_strength": slat_guidance_strength,
|
121 |
},
|
122 |
)
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
video_path = os.path.join(user_dir, 'sample.mp4')
|
127 |
-
|
128 |
state = pack_state(outputs['gaussian'][0], outputs['mesh'][0])
|
129 |
torch.cuda.empty_cache()
|
130 |
return state, video_path
|
|
|
120 |
"cfg_strength": slat_guidance_strength,
|
121 |
},
|
122 |
)
|
123 |
+
video = render_utils.render_video(outputs['gaussian'][0], num_frames=120)['color']
|
124 |
+
video_geo = render_utils.render_video(outputs['mesh'][0], num_frames=120)['normal']
|
125 |
+
video = [np.concatenate([video[i], video_geo[i]], axis=1) for i in range(len(video))]
|
126 |
video_path = os.path.join(user_dir, 'sample.mp4')
|
127 |
+
imageio.mimsave(video_path, video, fps=15)
|
128 |
state = pack_state(outputs['gaussian'][0], outputs['mesh'][0])
|
129 |
torch.cuda.empty_cache()
|
130 |
return state, video_path
|
trellis/pipelines/trellis_text_to_3d.py
CHANGED
@@ -220,15 +220,10 @@ class TrellisTextTo3DPipeline(Pipeline):
|
|
220 |
slat_sampler_params (dict): Additional parameters for the structured latent sampler.
|
221 |
formats (List[str]): The formats to decode the structured latent to.
|
222 |
"""
|
223 |
-
print(0)
|
224 |
cond = self.get_cond([prompt])
|
225 |
-
print(1)
|
226 |
torch.manual_seed(seed)
|
227 |
-
print(2)
|
228 |
coords = self.sample_sparse_structure(cond, num_samples, sparse_structure_sampler_params)
|
229 |
-
print(3)
|
230 |
slat = self.sample_slat(cond, coords, slat_sampler_params)
|
231 |
-
print(4)
|
232 |
return self.decode_slat(slat, formats)
|
233 |
'''
|
234 |
def voxelize(self, mesh: o3d.geometry.TriangleMesh) -> torch.Tensor:
|
|
|
220 |
slat_sampler_params (dict): Additional parameters for the structured latent sampler.
|
221 |
formats (List[str]): The formats to decode the structured latent to.
|
222 |
"""
|
|
|
223 |
cond = self.get_cond([prompt])
|
|
|
224 |
torch.manual_seed(seed)
|
|
|
225 |
coords = self.sample_sparse_structure(cond, num_samples, sparse_structure_sampler_params)
|
|
|
226 |
slat = self.sample_slat(cond, coords, slat_sampler_params)
|
|
|
227 |
return self.decode_slat(slat, formats)
|
228 |
'''
|
229 |
def voxelize(self, mesh: o3d.geometry.TriangleMesh) -> torch.Tensor:
|