Spaces:
Runtime error
Runtime error
Create run.ipynb
Browse files
run.ipynb
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
!pip install -q gradio
|
| 2 |
+
|
| 3 |
+
# Downloading files from the demo repo
|
| 4 |
+
import os
|
| 5 |
+
os.mkdir('files')
|
| 6 |
+
!wget -q -O files/Bunny.obj https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/Bunny.obj
|
| 7 |
+
!wget -q -O files/Duck.glb https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/Duck.glb
|
| 8 |
+
!wget -q -O files/Fox.gltf https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/Fox.gltf
|
| 9 |
+
!wget -q -O files/face.obj https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/face.obj
|
| 10 |
+
!wget -q -O files/sofia.stl https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/sofia.stl
|
| 11 |
+
!wget -q -O files/source.txt https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/source.txt
|
| 12 |
+
|
| 13 |
+
import gradio as gr
|
| 14 |
+
import os
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def load_mesh(mesh_file_name):
|
| 18 |
+
return mesh_file_name
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
demo = gr.Interface(
|
| 22 |
+
fn=load_mesh,
|
| 23 |
+
inputs=gr.Model3D(),
|
| 24 |
+
outputs=gr.Model3D(
|
| 25 |
+
clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model"),
|
| 26 |
+
examples=[
|
| 27 |
+
[os.path.join(os.path.abspath(''), "files/Bunny.obj")],
|
| 28 |
+
[os.path.join(os.path.abspath(''), "files/Duck.glb")],
|
| 29 |
+
[os.path.join(os.path.abspath(''), "files/Fox.gltf")],
|
| 30 |
+
[os.path.join(os.path.abspath(''), "files/face.obj")],
|
| 31 |
+
[os.path.join(os.path.abspath(''), "files/sofia.stl")],
|
| 32 |
+
["https://huggingface.co/datasets/dylanebert/3dgs/resolve/main/bonsai/bonsai-7k-mini.splat"],
|
| 33 |
+
["https://huggingface.co/datasets/dylanebert/3dgs/resolve/main/luigi/luigi.ply"],
|
| 34 |
+
],
|
| 35 |
+
cache_examples=True
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
if __name__ == "__main__":
|
| 39 |
+
demo.launch()
|