mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-15 02:11:15 +08:00
1718c4aeb2
* add STL 3D model support * add changeset * add model3D demo with stl support * add NASA open-soure SOFIA STL model source * modify model3D instead * fix notebook --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com> Co-authored-by: freddyaboulton <alfonsoboulton@gmail.com>
26 lines
686 B
Python
26 lines
686 B
Python
import gradio as gr
|
|
import os
|
|
|
|
|
|
def load_mesh(mesh_file_name):
|
|
return mesh_file_name
|
|
|
|
|
|
demo = gr.Interface(
|
|
fn=load_mesh,
|
|
inputs=gr.Model3D(),
|
|
outputs=gr.Model3D(
|
|
clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model"),
|
|
examples=[
|
|
[os.path.join(os.path.dirname(__file__), "files/Bunny.obj")],
|
|
[os.path.join(os.path.dirname(__file__), "files/Duck.glb")],
|
|
[os.path.join(os.path.dirname(__file__), "files/Fox.gltf")],
|
|
[os.path.join(os.path.dirname(__file__), "files/face.obj")],
|
|
[os.path.join(os.path.dirname(__file__), "files/sofia.stl")],
|
|
],
|
|
cache_examples=True
|
|
)
|
|
|
|
if __name__ == "__main__":
|
|
demo.launch()
|