Added 3D rendering demo + ignore gradio stuff [no ci]
Browse files- .gitignore +6 -0
- demo/app.py +19 -4
.gitignore
CHANGED
@@ -8,3 +8,9 @@ livermask.egg-info/
|
|
8 |
*.nii
|
9 |
*__pycache__/
|
10 |
.idea/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
*.nii
|
9 |
*__pycache__/
|
10 |
.idea/
|
11 |
+
*.glb
|
12 |
+
gradio_cached_examples/
|
13 |
+
flagged/
|
14 |
+
files/
|
15 |
+
*.csv
|
16 |
+
*.txt
|
demo/app.py
CHANGED
@@ -1,7 +1,22 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
def
|
4 |
-
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import subprocess as sp
|
3 |
|
4 |
+
def download_testdata():
|
5 |
+
sp.check_call(["wget", "https://github.com/gradio-app/gradio/raw/main/demo/model3D/files/Duck.glb"])
|
6 |
|
7 |
+
def load_mesh(mesh_file_name):
|
8 |
+
return mesh_file_name
|
9 |
+
|
10 |
+
demo = gr.Interface(
|
11 |
+
fn=load_mesh,
|
12 |
+
inputs=gr.Model3D(),
|
13 |
+
outputs=gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model"),
|
14 |
+
examples=[
|
15 |
+
["Duck.glb"],
|
16 |
+
],
|
17 |
+
cache_examples=True,
|
18 |
+
)
|
19 |
+
|
20 |
+
if __name__ == "__main__":
|
21 |
+
download_testdata()
|
22 |
+
demo.launch()
|