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