cube / app.py
julien-c's picture
julien-c HF Staff
one more try
b7b2d07 verified
raw
history blame
631 Bytes
import tempfile
import gradio as gr
from gradio.inputs import Image
from gradio.outputs import Image3D
from gltflib import GLTF, FileResource
gltf = GLTF.load('./Avocado.glb')
def load_mesh(im: str):
print(im)
model = gltf.clone()
res = FileResource(im.name)
with tempfile.NamedTemporaryFile(suffix=".glb", delete=False) as file:
model.export(file.name)
return file.name
iface = gr.Interface(
fn=load_mesh,
# inputs=gr.inputs.Image3D(),
inputs=Image(source="canvas", type="file", label="canvas"),
outputs=Image3D(),
live=True,
)
if __name__ == "__main__":
iface.launch()