cube / app.py
julien-c's picture
julien-c HF staff
initial test
527b9de verified
raw history blame
No virus
626 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)
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()