Download pyrender/examples/duck.py from hhhwmws/HaMeR: direct link, hf CLI and curl.
- Browser
- Download file 461 Bytes
-
https://huggingface.co/spaces/hhhwmws/HaMeR/resolve/main/pyrender/examples/duck.py
- Command line
-
hf download hf://spaces/hhhwmws/HaMeR/pyrender/examples/duck.py
-
curl -L -o duck.py https://huggingface.co/spaces/hhhwmws/HaMeR/resolve/main/pyrender/examples/duck.py
461 Bytes
| from pyrender import Mesh, Scene, Viewer | |
| from io import BytesIO | |
| import numpy as np | |
| import trimesh | |
| import requests | |
| duck_source = "https://github.com/KhronosGroup/glTF-Sample-Models/raw/master/2.0/Duck/glTF-Binary/Duck.glb" | |
| duck = trimesh.load(BytesIO(requests.get(duck_source).content), file_type='glb') | |
| duckmesh = Mesh.from_trimesh(list(duck.geometry.values())[0]) | |
| scene = Scene(ambient_light=np.array([1.0, 1.0, 1.0, 1.0])) | |
| scene.add(duckmesh) | |
| Viewer(scene) | |