Spaces:
Sleeping
Sleeping
dylanebert commited on
Commit ·
8a63854
1
Parent(s): ee54d2d
initial commit
Browse filesFiles changed (5)
- .gitattributes+1
- .gitignoreAdded+4
- app.pyAdded+38
- examples/chair.objAdded+3
- requirements.txtAdded+1
32 unmodified lines3334353632 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text*.obj filter=lfs diff=lfs merge=lfs -text1234__pycache__
gradio_cached_examples/venv/1234567891011121314151617181920212223242526272829303132333435363738import gradio as grimport trimeshfrom instant_texture import Converter
converter = Converter()
def extract_texture(mesh_path: str): mesh = trimesh.load(mesh_path) mesh = next(iter(mesh.geometry.values())) texture = mesh.visual.material.baseColorTexture return texture
def convert(input_mesh_path: str): if not input_mesh_path.endswith(".obj"): raise ValueError("Only .obj files are supported") output_path = "/tmp/output.glb" converter.convert(input_mesh_path, output_path) texture = extract_texture(output_path) return output_path, texture
demo = gr.Interface( convert, title="Instant Texture", description="Convert a vertex-colored mesh (.obj) to a uv-mapped, textured mesh (.glb).", inputs=gr.Model3D(label="Vertex-colored mesh (.obj)"), outputs=[ gr.Model3D(label="Output uv-mapped, textured mesh (.glb)"), gr.Image(label="Output texture"), ], examples=["examples/chair.obj"], cache_examples=True,)
if __name__ == "__main__": demo.queue().launch()123version https://git-lfs.github.com/spec/v1oid sha256:2d348aa68e6d3fc2b1359c3c60b227dc47484421cd0ce0bde81f386a4ec94ffasize 44536021instant-texture @ git+https://github.com/dylanebert/InstantTexture.gitattributes+1
.gitignoreAdded+4
app.pyAdded+38
examples/chair.objAdded+3
requirements.txtAdded+1