Spaces:
mashroo
/
Runtime error

YoussefAnso commited on
Commit
d65fe1c
·
1 Parent(s): 1ca648e

Update generate3d function to use a data dictionary for mesh export, improving compatibility with CRM model. Adjusted export call to include output directory and device parameters, while maintaining the conversion from .obj to .glb format.

Browse files
Files changed (1) hide show
  1. inference.py +6 -3
inference.py CHANGED
@@ -15,10 +15,13 @@ def generate3d(model, rgb_image, xyz_image, device="cpu"):
15
  obj_path = base_path + ".obj"
16
  glb_path = base_path + ".glb"
17
 
18
- # Export mesh using CRM model (generates .obj and textures)
19
- model.export_mesh_wt_uv(obj_path)
20
 
21
- # Load and convert to GLB
 
 
 
22
  mesh = Mesh.load(obj_path, device=torch.device("cpu"))
23
  mesh.write(glb_path)
24
 
 
15
  obj_path = base_path + ".obj"
16
  glb_path = base_path + ".glb"
17
 
18
+ # CRM export expects a data dictionary
19
+ data = {"rgb": rgb_image, "xyz": xyz_image}
20
 
21
+ # Export mesh using CRM model
22
+ model.export_mesh_wt_uv(data, output_dir, 0, device, 1024)
23
+
24
+ # Convert .obj to .glb
25
  mesh = Mesh.load(obj_path, device=torch.device("cpu"))
26
  mesh.write(glb_path)
27