Spaces:
Running on A100
Running on A100
Download mesh_inference.py from nvidia/PhysicalAI-Robotics-VoMP-Demo: direct link, hf CLI and curl.
- Browser
- Download file 777 Bytes
-
https://huggingface.co/spaces/nvidia/PhysicalAI-Robotics-VoMP-Demo/resolve/main/mesh_inference.py
- Command line
-
hf download hf://spaces/nvidia/PhysicalAI-Robotics-VoMP-Demo/mesh_inference.py
-
curl -L -o mesh_inference.py https://huggingface.co/spaces/nvidia/PhysicalAI-Robotics-VoMP-Demo/resolve/main/mesh_inference.py
777 Bytes
| import os | |
| import sys | |
| import bpy | |
| from vomp.inference import Vomp | |
| from vomp.inference.utils import save_materials | |
| input_file, output_dir, weights_dir = sys.argv[sys.argv.index("--") + 1:] | |
| model = Vomp.from_checkpoint( | |
| config_path=os.path.join(weights_dir, "inference.json"), | |
| geometry_checkpoint_dir=os.path.join(weights_dir, "geometry_transformer.pt"), | |
| matvae_checkpoint_dir=os.path.join(weights_dir, "matvae.safetensors"), | |
| normalization_params_path=os.path.join(weights_dir, "normalization_params.json"), | |
| ) | |
| results = model.get_mesh_materials( | |
| input_file, | |
| blender_path=bpy.app.binary_path, | |
| query_points="voxel_centers", | |
| output_dir=output_dir, | |
| return_original_scale=True, | |
| ) | |
| save_materials(results, os.path.join(output_dir, "materials.npz")) | |