Spaces:
Running
Running
import json | |
import pickle | |
import trimesh | |
def load_json(path): | |
with open(path) as f: | |
return json.load(f) | |
def save_json(o, path): | |
with open(path, "w") as f: | |
json.dump(o, f) | |
def load_pkl(path): | |
with open(path, "rb") as f: | |
return pickle.load(f) | |
def save_pkl(o, path): | |
with open(path, "wb") as f: | |
pickle.dump(o, f) | |
def save_mesh_with_colors(vertices, faces, save_path): | |
mesh = trimesh.Trimesh( | |
vertices=vertices, | |
faces=faces, | |
process=False, | |
) | |
mesh.export(save_path) | |