Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files- .gitattributes +8 -0
- README.md +65 -9
- app.py +64 -8
- assets/anya_rgba.png +0 -0
- assets/fox_rgba.png +0 -0
- assets/monkey_rgba.png +0 -0
- assets/tiger_rgba.png +0 -0
- logs/0d6e37451ce97b5e97dd74e63f9a06b17644f2ad02f32534ce079493808d288f.glb +3 -0
- logs/_tmp_gradio_312f2981ccbecf05b94e9729c5e88e720cafa46c_1e5133dcc83642c805644360a403f7c38a9dffc7f860cb96a678c76708d997c0.glb +3 -0
- logs/_tmp_gradio_6a883f05b5f52ebd382b11a3aef0825b272d0837_2f78ca4365556592bd54881407d40b3928870cfa6d89ec389b65356b3759c96c.glb +3 -0
- logs/tiger_rgba.glb +3 -0
- space.py +65 -9
- src/README.md +65 -9
- src/demo/app.py +64 -8
- src/demo/assets/anya_rgba.png +0 -0
- src/demo/assets/fox_rgba.png +0 -0
- src/demo/assets/monkey_rgba.png +0 -0
- src/demo/assets/tiger_rgba.png +0 -0
- src/demo/logs/0d6e37451ce97b5e97dd74e63f9a06b17644f2ad02f32534ce079493808d288f.glb +3 -0
- src/demo/logs/_tmp_gradio_312f2981ccbecf05b94e9729c5e88e720cafa46c_1e5133dcc83642c805644360a403f7c38a9dffc7f860cb96a678c76708d997c0.glb +3 -0
- src/demo/logs/_tmp_gradio_6a883f05b5f52ebd382b11a3aef0825b272d0837_2f78ca4365556592bd54881407d40b3928870cfa6d89ec389b65356b3759c96c.glb +3 -0
- src/demo/logs/tiger_rgba.glb +3 -0
- src/demo/space.py +65 -9
.gitattributes
CHANGED
@@ -33,3 +33,11 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
logs/0d6e37451ce97b5e97dd74e63f9a06b17644f2ad02f32534ce079493808d288f.glb filter=lfs diff=lfs merge=lfs -text
|
37 |
+
logs/_tmp_gradio_312f2981ccbecf05b94e9729c5e88e720cafa46c_1e5133dcc83642c805644360a403f7c38a9dffc7f860cb96a678c76708d997c0.glb filter=lfs diff=lfs merge=lfs -text
|
38 |
+
logs/_tmp_gradio_6a883f05b5f52ebd382b11a3aef0825b272d0837_2f78ca4365556592bd54881407d40b3928870cfa6d89ec389b65356b3759c96c.glb filter=lfs diff=lfs merge=lfs -text
|
39 |
+
logs/tiger_rgba.glb filter=lfs diff=lfs merge=lfs -text
|
40 |
+
src/demo/logs/0d6e37451ce97b5e97dd74e63f9a06b17644f2ad02f32534ce079493808d288f.glb filter=lfs diff=lfs merge=lfs -text
|
41 |
+
src/demo/logs/_tmp_gradio_312f2981ccbecf05b94e9729c5e88e720cafa46c_1e5133dcc83642c805644360a403f7c38a9dffc7f860cb96a678c76708d997c0.glb filter=lfs diff=lfs merge=lfs -text
|
42 |
+
src/demo/logs/_tmp_gradio_6a883f05b5f52ebd382b11a3aef0825b272d0837_2f78ca4365556592bd54881407d40b3928870cfa6d89ec389b65356b3759c96c.glb filter=lfs diff=lfs merge=lfs -text
|
43 |
+
src/demo/logs/tiger_rgba.glb filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -26,17 +26,73 @@ pip install gradio_model4dgs
|
|
26 |
import gradio as gr
|
27 |
from gradio_model4dgs import Model4DGS
|
28 |
import os
|
|
|
|
|
29 |
|
30 |
-
|
|
|
|
|
31 |
|
32 |
-
if
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
if __name__ == "__main__":
|
42 |
demo.launch(share=True)
|
|
|
26 |
import gradio as gr
|
27 |
from gradio_model4dgs import Model4DGS
|
28 |
import os
|
29 |
+
from PIL import Image
|
30 |
+
import hashlib
|
31 |
|
32 |
+
def check_img_input(control_image):
|
33 |
+
if control_image is None:
|
34 |
+
raise gr.Error("Please select or upload an input image")
|
35 |
|
36 |
+
if __name__ == "__main__":
|
37 |
+
_TITLE = '''DreamGaussian: Generative Gaussian Splatting for Efficient 3D Content Creation'''
|
38 |
+
|
39 |
+
_DESCRIPTION = '''
|
40 |
+
<div>
|
41 |
+
<a style="display:inline-block" href="https://jiawei-ren.github.io/projects/dreamgaussian4d/"><img src='https://img.shields.io/badge/public_website-8A2BE2'></a>
|
42 |
+
<a style="display:inline-block; margin-left: .5em" href="https://arxiv.org/abs/2312.17142"><img src="https://img.shields.io/badge/2309.16653-f9f7f7?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADcAAABMCAYAAADJPi9EAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAuIwAALiMBeKU/dgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAa2SURBVHja3Zt7bBRFGMAXUCDGF4rY7m7bAwuhlggKStFgLBgFEkCIIRJEEoOBYHwRFYKilUgEReVNJEGCJJpehHI3M9vZvd3bUP1DjNhEIRQQsQgSHiJgQZ5dv7krWEvvdmZ7d7vHJN+ft/f99pv5XvOtJMFCqvoCUpTdIEeRLC+L9Ox5i3Q9LACaCeK0kXoSChVcD3C/tQPHpAEsquQ73IkUcEz2kcLCknyGW5MGjkljRFVL8xJOKyi4CwCOuQAeAkfTP1+tNxLkogvgEbDgffkJ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dAipzacWN5nMl6XxNlUHa/J8DoJodUDE0HR8Ll5V0lPxcrLEHZPV4AzS83OLis7FowVa3RSku7BSNxJqQAlN3hBTC2apmDSkpaw22wJemGQFUG7J4MlP3JC6A+f96V7vRyX9It3nzT/GrjIU8edM7rMSnIi10f476lzbE1K7yEiEuWro0OJBguLCwDuFOJc1Na6sRWL/cCeMIwUN9ggSVbe3v/5/EgzTKWLvEAiBrYRUkgwNI2ZaFQNT75UDxEUEx97zYnzpmiLEmbaYCbNxYtFAb0/Z4AztgUrhyxuNgxPnhfHFDHz/vTgFWUQZxTRkkJhQ6YNdVUEPAfO6ZV5BRss6LcCVb7VaAma9giy0XJZBt9IQh42NY0NSdgbLIPlLUF6rEdrdt0CUCK1wsCbkcI3ZSLc7ZSwGLbmJXbPsNxnE5xilYKAobZ77LpGZ8TAIun+/iCKQoF71IxQDI3K2CCd+ARNvXg9sykBcnHAoCZG4u66hlDoQLe6QV4CRtFSxZQ+D0BwNO2jgdkzoGoah1nj3FVlSR19taTSYxI8QLut23U8dsgzqHulJNCQpcqBnpTALCuQ6NSYLHpmR5i42gZzuIdcrMMvMJbQlxe3jXxyZnLACl7ARm/FjPIDOY8ODtpM71sxwfcZpvBeUzKWmfNINM5AS+wO0Khh7dMqKccu4+qatarZjYAwDlgetzStHtEt+XedsBOQtU9XMrRgjg4KTnc5nr+dmqadit/4C4uLm8DuA9koJTj1TL7fI5nDL+qqoo/FLGAzL7dYT17PzvAcQONYSUQRxW/QMrHZVIyik0ZuQA2mzp+Ji8BW4YM3Mbzm9inaHkJCGfrUZZjujiYailfFwA8DHIy3acwUj4v9vUVa+SmgNsl5fuyDTKovW9/IAmfLV0Pi2UncA515kjYdrwC9i9rpuHiq3JwtAAAAABJRU5ErkJggg=="></a>
|
43 |
+
<a style="display:inline-block; margin-left: .5em" href='https://github.com/jiawei-ren/dreamgaussian4d'><img src='https://img.shields.io/github/stars/jiawei-ren/dreamgaussian4d?style=social'/></a>
|
44 |
+
</div>
|
45 |
+
We introduce DreamGaussian4D, an efficient 4D generation framework that builds on 4D Gaussian Splatting representation.
|
46 |
+
'''
|
47 |
+
|
48 |
+
# load images in 'assets' folder as examples
|
49 |
+
image_dir = os.path.join(os.path.dirname(__file__), "assets")
|
50 |
+
examples_img = None
|
51 |
+
|
52 |
+
if os.path.exists(image_dir) and os.path.isdir(image_dir) and os.listdir(image_dir):
|
53 |
+
examples_4d = [os.path.join(image_dir, file) for file in os.listdir(image_dir) if file.endswith('.ply')]
|
54 |
+
examples_img = [os.path.join(image_dir, file) for file in os.listdir(image_dir) if file.endswith('.png')]
|
55 |
+
else:
|
56 |
+
examples_4d = [os.path.join(os.path.dirname(__file__), example) for example in Model4DGS().example_inputs()]
|
57 |
+
|
58 |
+
def optimize(image_block: Image.Image):
|
59 |
+
# temporarily only show tiger
|
60 |
+
return f'{os.path.join(os.path.dirname(__file__), "logs")}/tiger.glb', examples_4d
|
61 |
+
|
62 |
+
# Compose demo layout & data flow
|
63 |
+
with gr.Blocks(title=_TITLE, theme=gr.themes.Soft()) as demo:
|
64 |
+
with gr.Row():
|
65 |
+
with gr.Column(scale=1):
|
66 |
+
gr.Markdown('# ' + _TITLE)
|
67 |
+
gr.Markdown(_DESCRIPTION)
|
68 |
+
|
69 |
+
with gr.Row(variant='panel'):
|
70 |
+
left_column = gr.Column(scale=5)
|
71 |
+
with left_column:
|
72 |
+
image_block = gr.Image(type='pil', image_mode='RGBA', height=290, label='Input image')
|
73 |
+
|
74 |
+
preprocess_chk = gr.Checkbox(True,
|
75 |
+
label='Preprocess image automatically (remove background and recenter object)')
|
76 |
+
|
77 |
+
with gr.Column(scale=5):
|
78 |
+
obj3d = gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model (Final)")
|
79 |
+
obj4d = Model4DGS(label="4D Model")
|
80 |
+
|
81 |
+
with left_column:
|
82 |
+
gr.Examples(
|
83 |
+
examples=examples_img, # NOTE: elements must match inputs list!
|
84 |
+
inputs=image_block,
|
85 |
+
outputs=obj3d,
|
86 |
+
fn=optimize,
|
87 |
+
label='Examples (click one of the images below to start)',
|
88 |
+
examples_per_page=40
|
89 |
+
)
|
90 |
+
img_run_btn = gr.Button("Generate 4D")
|
91 |
+
|
92 |
+
# if there is an input image, continue with inference
|
93 |
+
# else display an error message
|
94 |
+
img_run_btn.click(check_img_input, inputs=[image_block], queue=False).success(
|
95 |
+
optimize, inputs=[image_block], outputs=[obj3d, obj4d])
|
96 |
|
97 |
if __name__ == "__main__":
|
98 |
demo.launch(share=True)
|
app.py
CHANGED
@@ -1,17 +1,73 @@
|
|
1 |
import gradio as gr
|
2 |
from gradio_model4dgs import Model4DGS
|
3 |
import os
|
|
|
|
|
4 |
|
5 |
-
|
|
|
|
|
6 |
|
7 |
-
if
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
15 |
|
16 |
if __name__ == "__main__":
|
17 |
demo.launch(share=True)
|
|
|
1 |
import gradio as gr
|
2 |
from gradio_model4dgs import Model4DGS
|
3 |
import os
|
4 |
+
from PIL import Image
|
5 |
+
import hashlib
|
6 |
|
7 |
+
def check_img_input(control_image):
|
8 |
+
if control_image is None:
|
9 |
+
raise gr.Error("Please select or upload an input image")
|
10 |
|
11 |
+
if __name__ == "__main__":
|
12 |
+
_TITLE = '''DreamGaussian: Generative Gaussian Splatting for Efficient 3D Content Creation'''
|
13 |
+
|
14 |
+
_DESCRIPTION = '''
|
15 |
+
<div>
|
16 |
+
<a style="display:inline-block" href="https://jiawei-ren.github.io/projects/dreamgaussian4d/"><img src='https://img.shields.io/badge/public_website-8A2BE2'></a>
|
17 |
+
<a style="display:inline-block; margin-left: .5em" href="https://arxiv.org/abs/2312.17142"><img src="https://img.shields.io/badge/2309.16653-f9f7f7?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADcAAABMCAYAAADJPi9EAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAuIwAALiMBeKU/dgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAa2SURBVHja3Zt7bBRFGMAXUCDGF4rY7m7bAwuhlggKStFgLBgFEkCIIRJEEoOBYHwRFYKilUgEReVNJEGCJJpehHI3M9vZvd3bUP1DjNhEIRQQsQgSHiJgQZ5dv7krWEvvdmZ7d7vHJN+ft/f99pv5XvOtJMFCqvoCUpTdIEeRLC+L9Ox5i3Q9LACaCeK0kXoSChVcD3C/tQPHpAEsquQ73IkUcEz2kcLCknyGW5MGjkljRFVL8xJOKyi4CwCOuQAeAkfTP1+tNxLkogvgEbDgffkJqKqvuMA5ifOpqg/5qWecRstNg7xoUTI1Fovdxg8oy2s5AP8CGeYHmGngeZaOL4I4LXLcpHg4149/GDz4xqgsb+UAbMKKUpkrqHA43MUyyJpWUK0EHeG2YKRXr7tB+QMcgGewLD+ebTDbtrtbBt7UPlhS4rV4IvcDI7J8P1OeA/AcAI7LHljN7aB8XTowJmZt9EFRD/o0SDMH4HlwMhMyDWZZSAHFf3YDs3RS49WDLuaAY3IJq+qzmQKLxXAZKN7oDoYbdV3v5elPqiSpMyiOuAEVZVqHXb1OhloUH+MA+ztO0cAO/RkrfyBE7OAEbAZvO8vzVtTRWFD6DAfY5biBM3PWiaL0a4lvXICwnV8WjmE6ntYmhqX2jjp5LbMZjCw/wbYeN6CizOa2GMVzQOlmHjB4Ceuyk6LJ8huccEmR5Xddg7OOV/NAtchW+E3XbOag60QA4Qwuarca0bRuEJyr+cFQwzcY98huxhAKdQelt4kAQpj4qJ3gvFXAYn+aJumXk1yPlpQUgtIHhbYoFM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ah1nj3FVlSR19taTSYxI8QLut23U8dsgzqHulJNCQpcqBnpTALCuQ6NSYLHpmR5i42gZzuIdcrMMvMJbQlxe3jXxyZnLACl7ARm/FjPIDOY8ODtpM71sxwfcZpvBeUzKWmfNINM5AS+wO0Khh7dMqKccu4+qatarZjYAwDlgetzStHtEt+XedsBOQtU9XMrRgjg4KTnc5nr+dmqadit/4C4uLm8DuA9koJTj1TL7fI5nDL+qqoo/FLGAzL7dYT17PzvAcQONYSUQRxW/QMrHZVIyik0ZuQA2mzp+Ji8BW4YM3Mbzm9inaHkJCGfrUZZjujiYailfFwA8DHIy3acwUj4v9vUVa+SmgNsl5fuyDTKovW9/IAmfLV0Pi2UncA515kjYdrwC9i9rpuHiq3JwtAAAAABJRU5ErkJggg=="></a>
|
18 |
+
<a style="display:inline-block; margin-left: .5em" href='https://github.com/jiawei-ren/dreamgaussian4d'><img src='https://img.shields.io/github/stars/jiawei-ren/dreamgaussian4d?style=social'/></a>
|
19 |
+
</div>
|
20 |
+
We introduce DreamGaussian4D, an efficient 4D generation framework that builds on 4D Gaussian Splatting representation.
|
21 |
+
'''
|
22 |
+
|
23 |
+
# load images in 'assets' folder as examples
|
24 |
+
image_dir = os.path.join(os.path.dirname(__file__), "assets")
|
25 |
+
examples_img = None
|
26 |
+
|
27 |
+
if os.path.exists(image_dir) and os.path.isdir(image_dir) and os.listdir(image_dir):
|
28 |
+
examples_4d = [os.path.join(image_dir, file) for file in os.listdir(image_dir) if file.endswith('.ply')]
|
29 |
+
examples_img = [os.path.join(image_dir, file) for file in os.listdir(image_dir) if file.endswith('.png')]
|
30 |
+
else:
|
31 |
+
examples_4d = [os.path.join(os.path.dirname(__file__), example) for example in Model4DGS().example_inputs()]
|
32 |
+
|
33 |
+
def optimize(image_block: Image.Image):
|
34 |
+
# temporarily only show tiger
|
35 |
+
return f'{os.path.join(os.path.dirname(__file__), "logs")}/tiger.glb', examples_4d
|
36 |
+
|
37 |
+
# Compose demo layout & data flow
|
38 |
+
with gr.Blocks(title=_TITLE, theme=gr.themes.Soft()) as demo:
|
39 |
+
with gr.Row():
|
40 |
+
with gr.Column(scale=1):
|
41 |
+
gr.Markdown('# ' + _TITLE)
|
42 |
+
gr.Markdown(_DESCRIPTION)
|
43 |
+
|
44 |
+
with gr.Row(variant='panel'):
|
45 |
+
left_column = gr.Column(scale=5)
|
46 |
+
with left_column:
|
47 |
+
image_block = gr.Image(type='pil', image_mode='RGBA', height=290, label='Input image')
|
48 |
+
|
49 |
+
preprocess_chk = gr.Checkbox(True,
|
50 |
+
label='Preprocess image automatically (remove background and recenter object)')
|
51 |
+
|
52 |
+
with gr.Column(scale=5):
|
53 |
+
obj3d = gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model (Final)")
|
54 |
+
obj4d = Model4DGS(label="4D Model")
|
55 |
+
|
56 |
+
with left_column:
|
57 |
+
gr.Examples(
|
58 |
+
examples=examples_img, # NOTE: elements must match inputs list!
|
59 |
+
inputs=image_block,
|
60 |
+
outputs=obj3d,
|
61 |
+
fn=optimize,
|
62 |
+
label='Examples (click one of the images below to start)',
|
63 |
+
examples_per_page=40
|
64 |
+
)
|
65 |
+
img_run_btn = gr.Button("Generate 4D")
|
66 |
|
67 |
+
# if there is an input image, continue with inference
|
68 |
+
# else display an error message
|
69 |
+
img_run_btn.click(check_img_input, inputs=[image_block], queue=False).success(
|
70 |
+
optimize, inputs=[image_block], outputs=[obj3d, obj4d])
|
71 |
|
72 |
if __name__ == "__main__":
|
73 |
demo.launch(share=True)
|
assets/anya_rgba.png
ADDED
assets/fox_rgba.png
ADDED
assets/monkey_rgba.png
ADDED
assets/tiger_rgba.png
ADDED
logs/0d6e37451ce97b5e97dd74e63f9a06b17644f2ad02f32534ce079493808d288f.glb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:36c0b461d6973a61b97cfdcffb49c1e6e2ac2730cda3da2a53ca18eb1300c21d
|
3 |
+
size 2101240
|
logs/_tmp_gradio_312f2981ccbecf05b94e9729c5e88e720cafa46c_1e5133dcc83642c805644360a403f7c38a9dffc7f860cb96a678c76708d997c0.glb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3f898caa81d1c4eebae1bd8a3dd0581fd787290abc7c174051c0ab0366bb231f
|
3 |
+
size 2614792
|
logs/_tmp_gradio_6a883f05b5f52ebd382b11a3aef0825b272d0837_2f78ca4365556592bd54881407d40b3928870cfa6d89ec389b65356b3759c96c.glb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3f4b8d60a1208343c984b7bb129efb0a175b7f7dddd737e98e0302f4931f6dda
|
3 |
+
size 2711984
|
logs/tiger_rgba.glb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3f898caa81d1c4eebae1bd8a3dd0581fd787290abc7c174051c0ab0366bb231f
|
3 |
+
size 2614792
|
space.py
CHANGED
@@ -41,17 +41,73 @@ pip install gradio_model4dgs
|
|
41 |
import gradio as gr
|
42 |
from gradio_model4dgs import Model4DGS
|
43 |
import os
|
|
|
|
|
44 |
|
45 |
-
|
|
|
|
|
46 |
|
47 |
-
if
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
if __name__ == "__main__":
|
57 |
demo.launch(share=True)
|
|
|
41 |
import gradio as gr
|
42 |
from gradio_model4dgs import Model4DGS
|
43 |
import os
|
44 |
+
from PIL import Image
|
45 |
+
import hashlib
|
46 |
|
47 |
+
def check_img_input(control_image):
|
48 |
+
if control_image is None:
|
49 |
+
raise gr.Error("Please select or upload an input image")
|
50 |
|
51 |
+
if __name__ == "__main__":
|
52 |
+
_TITLE = '''DreamGaussian: Generative Gaussian Splatting for Efficient 3D Content Creation'''
|
53 |
+
|
54 |
+
_DESCRIPTION = '''
|
55 |
+
<div>
|
56 |
+
<a style="display:inline-block" href="https://jiawei-ren.github.io/projects/dreamgaussian4d/"><img src='https://img.shields.io/badge/public_website-8A2BE2'></a>
|
57 |
+
<a style="display:inline-block; margin-left: .5em" href="https://arxiv.org/abs/2312.17142"><img src="https://img.shields.io/badge/2309.16653-f9f7f7?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADcAAABMCAYAAADJPi9EAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAuIwAALiMBeKU/dgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAa2SURBVHja3Zt7bBRFGMAXUCDGF4rY7m7bAwuhlggKStFgLBgFEkCIIRJEEoOBYHwRFYKilUgEReVNJEGCJJpehHI3M9vZvd3bUP1DjNhEIRQQsQgSHiJgQZ5dv7krWEvvdmZ7d7vHJN+ft/f99pv5XvOtJMFCqvoCUpTdIEeRLC+L9Ox5i3Q9LACaCeK0kXoSChVcD3C/tQPHpAEsquQ73IkUcEz2kcLCknyGW5MGjkljRFVL8xJOKyi4CwCOuQAeAkfTP1+tNxLkogvgEbDgffkJqKqvuMA5ifOpqg/5qWecRstNg7xoUTI1Fovdxg8oy2s5AP8CGeYHmGngeZaOL4I4LXLcpHg4149/GDz4xqgsb+UAbMKKUpkrqHA43MUyyJpWUK0EHeG2YKRXr7tB+QMcgGewLD+ebTDbtrtbBt7UPlhS4rV4IvcD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yEiEuWro0OJBguLCwDuFOJc1Na6sRWL/cCeMIwUN9ggSVbe3v/5/EgzTKWLvEAiBrYRUkgwNI2ZaFQNT75UDxEUEx97zYnzpmiLEmbaYCbNxYtFAb0/Z4AztgUrhyxuNgxPnhfHFDHz/vTgFWUQZxTRkkJhQ6YNdVUEPAfO6ZV5BRss6LcCVb7VaAma9giy0XJZBt9IQh42NY0NSdgbLIPlLUF6rEdrdt0CUCK1wsCbkcI3ZSLc7ZSwGLbmJXbPsNxnE5xilYKAobZ77LpGZ8TAIun+/iCKQoF71IxQDI3K2CCd+ARNvXg9sykBcnHAoCZG4u66hlDoQLe6QV4CRtFSxZQ+D0BwNO2jgdkzoGoah1nj3FVlSR19taTSYxI8QLut23U8dsgzqHulJNCQpcqBnpTALCuQ6NSYLHpmR5i42gZzuIdcrMMvMJbQlxe3jXxyZnLACl7ARm/FjPIDOY8ODtpM71sxwfcZpvBeUzKWmfNINM5AS+wO0Khh7dMqKccu4+qatarZjYAwDlgetzStHtEt+XedsBOQtU9XMrRgjg4KTnc5nr+dmqadit/4C4uLm8DuA9koJTj1TL7fI5nDL+qqoo/FLGAzL7dYT17PzvAcQONYSUQRxW/QMrHZVIyik0ZuQA2mzp+Ji8BW4YM3Mbzm9inaHkJCGfrUZZjujiYailfFwA8DHIy3acwUj4v9vUVa+SmgNsl5fuyDTKovW9/IAmfLV0Pi2UncA515kjYdrwC9i9rpuHiq3JwtAAAAABJRU5ErkJggg=="></a>
|
58 |
+
<a style="display:inline-block; margin-left: .5em" href='https://github.com/jiawei-ren/dreamgaussian4d'><img src='https://img.shields.io/github/stars/jiawei-ren/dreamgaussian4d?style=social'/></a>
|
59 |
+
</div>
|
60 |
+
We introduce DreamGaussian4D, an efficient 4D generation framework that builds on 4D Gaussian Splatting representation.
|
61 |
+
'''
|
62 |
+
|
63 |
+
# load images in 'assets' folder as examples
|
64 |
+
image_dir = os.path.join(os.path.dirname(__file__), "assets")
|
65 |
+
examples_img = None
|
66 |
+
|
67 |
+
if os.path.exists(image_dir) and os.path.isdir(image_dir) and os.listdir(image_dir):
|
68 |
+
examples_4d = [os.path.join(image_dir, file) for file in os.listdir(image_dir) if file.endswith('.ply')]
|
69 |
+
examples_img = [os.path.join(image_dir, file) for file in os.listdir(image_dir) if file.endswith('.png')]
|
70 |
+
else:
|
71 |
+
examples_4d = [os.path.join(os.path.dirname(__file__), example) for example in Model4DGS().example_inputs()]
|
72 |
+
|
73 |
+
def optimize(image_block: Image.Image):
|
74 |
+
# temporarily only show tiger
|
75 |
+
return f'{os.path.join(os.path.dirname(__file__), "logs")}/tiger.glb', examples_4d
|
76 |
+
|
77 |
+
# Compose demo layout & data flow
|
78 |
+
with gr.Blocks(title=_TITLE, theme=gr.themes.Soft()) as demo:
|
79 |
+
with gr.Row():
|
80 |
+
with gr.Column(scale=1):
|
81 |
+
gr.Markdown('# ' + _TITLE)
|
82 |
+
gr.Markdown(_DESCRIPTION)
|
83 |
+
|
84 |
+
with gr.Row(variant='panel'):
|
85 |
+
left_column = gr.Column(scale=5)
|
86 |
+
with left_column:
|
87 |
+
image_block = gr.Image(type='pil', image_mode='RGBA', height=290, label='Input image')
|
88 |
+
|
89 |
+
preprocess_chk = gr.Checkbox(True,
|
90 |
+
label='Preprocess image automatically (remove background and recenter object)')
|
91 |
+
|
92 |
+
with gr.Column(scale=5):
|
93 |
+
obj3d = gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model (Final)")
|
94 |
+
obj4d = Model4DGS(label="4D Model")
|
95 |
+
|
96 |
+
with left_column:
|
97 |
+
gr.Examples(
|
98 |
+
examples=examples_img, # NOTE: elements must match inputs list!
|
99 |
+
inputs=image_block,
|
100 |
+
outputs=obj3d,
|
101 |
+
fn=optimize,
|
102 |
+
label='Examples (click one of the images below to start)',
|
103 |
+
examples_per_page=40
|
104 |
+
)
|
105 |
+
img_run_btn = gr.Button("Generate 4D")
|
106 |
+
|
107 |
+
# if there is an input image, continue with inference
|
108 |
+
# else display an error message
|
109 |
+
img_run_btn.click(check_img_input, inputs=[image_block], queue=False).success(
|
110 |
+
optimize, inputs=[image_block], outputs=[obj3d, obj4d])
|
111 |
|
112 |
if __name__ == "__main__":
|
113 |
demo.launch(share=True)
|
src/README.md
CHANGED
@@ -26,17 +26,73 @@ pip install gradio_model4dgs
|
|
26 |
import gradio as gr
|
27 |
from gradio_model4dgs import Model4DGS
|
28 |
import os
|
|
|
|
|
29 |
|
30 |
-
|
|
|
|
|
31 |
|
32 |
-
if
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
if __name__ == "__main__":
|
42 |
demo.launch(share=True)
|
|
|
26 |
import gradio as gr
|
27 |
from gradio_model4dgs import Model4DGS
|
28 |
import os
|
29 |
+
from PIL import Image
|
30 |
+
import hashlib
|
31 |
|
32 |
+
def check_img_input(control_image):
|
33 |
+
if control_image is None:
|
34 |
+
raise gr.Error("Please select or upload an input image")
|
35 |
|
36 |
+
if __name__ == "__main__":
|
37 |
+
_TITLE = '''DreamGaussian: Generative Gaussian Splatting for Efficient 3D Content Creation'''
|
38 |
+
|
39 |
+
_DESCRIPTION = '''
|
40 |
+
<div>
|
41 |
+
<a style="display:inline-block" href="https://jiawei-ren.github.io/projects/dreamgaussian4d/"><img src='https://img.shields.io/badge/public_website-8A2BE2'></a>
|
42 |
+
<a style="display:inline-block; margin-left: .5em" href="https://arxiv.org/abs/2312.17142"><img src="https://img.shields.io/badge/2309.16653-f9f7f7?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADcAAABM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dMqKccu4+qatarZjYAwDlgetzStHtEt+XedsBOQtU9XMrRgjg4KTnc5nr+dmqadit/4C4uLm8DuA9koJTj1TL7fI5nDL+qqoo/FLGAzL7dYT17PzvAcQONYSUQRxW/QMrHZVIyik0ZuQA2mzp+Ji8BW4YM3Mbzm9inaHkJCGfrUZZjujiYailfFwA8DHIy3acwUj4v9vUVa+SmgNsl5fuyDTKovW9/IAmfLV0Pi2UncA515kjYdrwC9i9rpuHiq3JwtAAAAABJRU5ErkJggg=="></a>
|
43 |
+
<a style="display:inline-block; margin-left: .5em" href='https://github.com/jiawei-ren/dreamgaussian4d'><img src='https://img.shields.io/github/stars/jiawei-ren/dreamgaussian4d?style=social'/></a>
|
44 |
+
</div>
|
45 |
+
We introduce DreamGaussian4D, an efficient 4D generation framework that builds on 4D Gaussian Splatting representation.
|
46 |
+
'''
|
47 |
+
|
48 |
+
# load images in 'assets' folder as examples
|
49 |
+
image_dir = os.path.join(os.path.dirname(__file__), "assets")
|
50 |
+
examples_img = None
|
51 |
+
|
52 |
+
if os.path.exists(image_dir) and os.path.isdir(image_dir) and os.listdir(image_dir):
|
53 |
+
examples_4d = [os.path.join(image_dir, file) for file in os.listdir(image_dir) if file.endswith('.ply')]
|
54 |
+
examples_img = [os.path.join(image_dir, file) for file in os.listdir(image_dir) if file.endswith('.png')]
|
55 |
+
else:
|
56 |
+
examples_4d = [os.path.join(os.path.dirname(__file__), example) for example in Model4DGS().example_inputs()]
|
57 |
+
|
58 |
+
def optimize(image_block: Image.Image):
|
59 |
+
# temporarily only show tiger
|
60 |
+
return f'{os.path.join(os.path.dirname(__file__), "logs")}/tiger.glb', examples_4d
|
61 |
+
|
62 |
+
# Compose demo layout & data flow
|
63 |
+
with gr.Blocks(title=_TITLE, theme=gr.themes.Soft()) as demo:
|
64 |
+
with gr.Row():
|
65 |
+
with gr.Column(scale=1):
|
66 |
+
gr.Markdown('# ' + _TITLE)
|
67 |
+
gr.Markdown(_DESCRIPTION)
|
68 |
+
|
69 |
+
with gr.Row(variant='panel'):
|
70 |
+
left_column = gr.Column(scale=5)
|
71 |
+
with left_column:
|
72 |
+
image_block = gr.Image(type='pil', image_mode='RGBA', height=290, label='Input image')
|
73 |
+
|
74 |
+
preprocess_chk = gr.Checkbox(True,
|
75 |
+
label='Preprocess image automatically (remove background and recenter object)')
|
76 |
+
|
77 |
+
with gr.Column(scale=5):
|
78 |
+
obj3d = gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model (Final)")
|
79 |
+
obj4d = Model4DGS(label="4D Model")
|
80 |
+
|
81 |
+
with left_column:
|
82 |
+
gr.Examples(
|
83 |
+
examples=examples_img, # NOTE: elements must match inputs list!
|
84 |
+
inputs=image_block,
|
85 |
+
outputs=obj3d,
|
86 |
+
fn=optimize,
|
87 |
+
label='Examples (click one of the images below to start)',
|
88 |
+
examples_per_page=40
|
89 |
+
)
|
90 |
+
img_run_btn = gr.Button("Generate 4D")
|
91 |
+
|
92 |
+
# if there is an input image, continue with inference
|
93 |
+
# else display an error message
|
94 |
+
img_run_btn.click(check_img_input, inputs=[image_block], queue=False).success(
|
95 |
+
optimize, inputs=[image_block], outputs=[obj3d, obj4d])
|
96 |
|
97 |
if __name__ == "__main__":
|
98 |
demo.launch(share=True)
|
src/demo/app.py
CHANGED
@@ -1,17 +1,73 @@
|
|
1 |
import gradio as gr
|
2 |
from gradio_model4dgs import Model4DGS
|
3 |
import os
|
|
|
|
|
4 |
|
5 |
-
|
|
|
|
|
6 |
|
7 |
-
if
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
15 |
|
16 |
if __name__ == "__main__":
|
17 |
demo.launch(share=True)
|
|
|
1 |
import gradio as gr
|
2 |
from gradio_model4dgs import Model4DGS
|
3 |
import os
|
4 |
+
from PIL import Image
|
5 |
+
import hashlib
|
6 |
|
7 |
+
def check_img_input(control_image):
|
8 |
+
if control_image is None:
|
9 |
+
raise gr.Error("Please select or upload an input image")
|
10 |
|
11 |
+
if __name__ == "__main__":
|
12 |
+
_TITLE = '''DreamGaussian: Generative Gaussian Splatting for Efficient 3D Content Creation'''
|
13 |
+
|
14 |
+
_DESCRIPTION = '''
|
15 |
+
<div>
|
16 |
+
<a style="display:inline-block" href="https://jiawei-ren.github.io/projects/dreamgaussian4d/"><img src='https://img.shields.io/badge/public_website-8A2BE2'></a>
|
17 |
+
<a style="display:inline-block; margin-left: .5em" href="https://arxiv.org/abs/2312.17142"><img src="https://img.shields.io/badge/2309.16653-f9f7f7?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADcAAABMCAYAAADJPi9EAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAuIwAALiMBeKU/dgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAa2SURBVHja3Zt7bBRFGMAXUCDGF4rY7m7bAwuhlggKStFgLBgFEkCIIRJEEoOBYHwRFYKilUgEReVNJEGCJJpehHI3M9vZvd3bUP1DjNhEIRQQsQgSHiJgQZ5dv7krWEvvdmZ7d7vHJN+ft/f99pv5XvOtJMFCqvoCUpTdIEeRLC+L9Ox5i3Q9LACaCeK0kXoSChVcD3C/tQPHpAEsquQ73IkUcEz2kcLCknyGW5MGjkljRFVL8xJOKyi4CwCOuQAeAkfTP1+tNxLkogvgEbDgffkJqKqvuMA5ifOpqg/5qWecRstNg7xoUTI1Fovdxg8oy2s5AP8CGeYHmGngeZaOL4I4LXLcpHg4149/GDz4xqgsb+UAbMKKUpkrqHA43MUyyJpWUK0EHeG2YKRXr7tB+QMcg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3nzT/GrjIU8edM7rMSnIi10f476lzbE1K7yEiEuWro0OJBguLCwDuFOJc1Na6sRWL/cCeMIwUN9ggSVbe3v/5/EgzTKWLvEAiBrYRUkgwNI2ZaFQNT75UDxEUEx97zYnzpmiLEmbaYCbNxYtFAb0/Z4AztgUrhyxuNgxPnhfHFDHz/vTgFWUQZxTRkkJhQ6YNdVUEPAfO6ZV5BRss6LcCVb7VaAma9giy0XJZBt9IQh42NY0NSdgbLIPlLUF6rEdrdt0CUCK1wsCbkcI3ZSLc7ZSwGLbmJXbPsNxnE5xilYKAobZ77LpGZ8TAIun+/iCKQoF71IxQDI3K2CCd+ARNvXg9sykBcnHAoCZG4u66hlDoQLe6QV4CRtFSxZQ+D0BwNO2jgdkzoGoah1nj3FVlSR19taTSYxI8QLut23U8dsgzqHulJNCQpcqBnpTALCuQ6NSYLHpmR5i42gZzuIdcrMMvMJbQlxe3jXxyZnLACl7ARm/FjPIDOY8ODtpM71sxwfcZpvBeUzKWmfNINM5AS+wO0Khh7dMqKccu4+qatarZjYAwDlgetzStHtEt+XedsBOQtU9XMrRgjg4KTnc5nr+dmqadit/4C4uLm8DuA9koJTj1TL7fI5nDL+qqoo/FLGAzL7dYT17PzvAcQONYSUQRxW/QMrHZVIyik0ZuQA2mzp+Ji8BW4YM3Mbzm9inaHkJCGfrUZZjujiYailfFwA8DHIy3acwUj4v9vUVa+SmgNsl5fuyDTKovW9/IAmfLV0Pi2UncA515kjYdrwC9i9rpuHiq3JwtAAAAABJRU5ErkJggg=="></a>
|
18 |
+
<a style="display:inline-block; margin-left: .5em" href='https://github.com/jiawei-ren/dreamgaussian4d'><img src='https://img.shields.io/github/stars/jiawei-ren/dreamgaussian4d?style=social'/></a>
|
19 |
+
</div>
|
20 |
+
We introduce DreamGaussian4D, an efficient 4D generation framework that builds on 4D Gaussian Splatting representation.
|
21 |
+
'''
|
22 |
+
|
23 |
+
# load images in 'assets' folder as examples
|
24 |
+
image_dir = os.path.join(os.path.dirname(__file__), "assets")
|
25 |
+
examples_img = None
|
26 |
+
|
27 |
+
if os.path.exists(image_dir) and os.path.isdir(image_dir) and os.listdir(image_dir):
|
28 |
+
examples_4d = [os.path.join(image_dir, file) for file in os.listdir(image_dir) if file.endswith('.ply')]
|
29 |
+
examples_img = [os.path.join(image_dir, file) for file in os.listdir(image_dir) if file.endswith('.png')]
|
30 |
+
else:
|
31 |
+
examples_4d = [os.path.join(os.path.dirname(__file__), example) for example in Model4DGS().example_inputs()]
|
32 |
+
|
33 |
+
def optimize(image_block: Image.Image):
|
34 |
+
# temporarily only show tiger
|
35 |
+
return f'{os.path.join(os.path.dirname(__file__), "logs")}/tiger.glb', examples_4d
|
36 |
+
|
37 |
+
# Compose demo layout & data flow
|
38 |
+
with gr.Blocks(title=_TITLE, theme=gr.themes.Soft()) as demo:
|
39 |
+
with gr.Row():
|
40 |
+
with gr.Column(scale=1):
|
41 |
+
gr.Markdown('# ' + _TITLE)
|
42 |
+
gr.Markdown(_DESCRIPTION)
|
43 |
+
|
44 |
+
with gr.Row(variant='panel'):
|
45 |
+
left_column = gr.Column(scale=5)
|
46 |
+
with left_column:
|
47 |
+
image_block = gr.Image(type='pil', image_mode='RGBA', height=290, label='Input image')
|
48 |
+
|
49 |
+
preprocess_chk = gr.Checkbox(True,
|
50 |
+
label='Preprocess image automatically (remove background and recenter object)')
|
51 |
+
|
52 |
+
with gr.Column(scale=5):
|
53 |
+
obj3d = gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model (Final)")
|
54 |
+
obj4d = Model4DGS(label="4D Model")
|
55 |
+
|
56 |
+
with left_column:
|
57 |
+
gr.Examples(
|
58 |
+
examples=examples_img, # NOTE: elements must match inputs list!
|
59 |
+
inputs=image_block,
|
60 |
+
outputs=obj3d,
|
61 |
+
fn=optimize,
|
62 |
+
label='Examples (click one of the images below to start)',
|
63 |
+
examples_per_page=40
|
64 |
+
)
|
65 |
+
img_run_btn = gr.Button("Generate 4D")
|
66 |
|
67 |
+
# if there is an input image, continue with inference
|
68 |
+
# else display an error message
|
69 |
+
img_run_btn.click(check_img_input, inputs=[image_block], queue=False).success(
|
70 |
+
optimize, inputs=[image_block], outputs=[obj3d, obj4d])
|
71 |
|
72 |
if __name__ == "__main__":
|
73 |
demo.launch(share=True)
|
src/demo/assets/anya_rgba.png
ADDED
src/demo/assets/fox_rgba.png
ADDED
src/demo/assets/monkey_rgba.png
ADDED
src/demo/assets/tiger_rgba.png
ADDED
src/demo/logs/0d6e37451ce97b5e97dd74e63f9a06b17644f2ad02f32534ce079493808d288f.glb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:36c0b461d6973a61b97cfdcffb49c1e6e2ac2730cda3da2a53ca18eb1300c21d
|
3 |
+
size 2101240
|
src/demo/logs/_tmp_gradio_312f2981ccbecf05b94e9729c5e88e720cafa46c_1e5133dcc83642c805644360a403f7c38a9dffc7f860cb96a678c76708d997c0.glb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3f898caa81d1c4eebae1bd8a3dd0581fd787290abc7c174051c0ab0366bb231f
|
3 |
+
size 2614792
|
src/demo/logs/_tmp_gradio_6a883f05b5f52ebd382b11a3aef0825b272d0837_2f78ca4365556592bd54881407d40b3928870cfa6d89ec389b65356b3759c96c.glb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3f4b8d60a1208343c984b7bb129efb0a175b7f7dddd737e98e0302f4931f6dda
|
3 |
+
size 2711984
|
src/demo/logs/tiger_rgba.glb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3f898caa81d1c4eebae1bd8a3dd0581fd787290abc7c174051c0ab0366bb231f
|
3 |
+
size 2614792
|
src/demo/space.py
CHANGED
@@ -41,17 +41,73 @@ pip install gradio_model4dgs
|
|
41 |
import gradio as gr
|
42 |
from gradio_model4dgs import Model4DGS
|
43 |
import os
|
|
|
|
|
44 |
|
45 |
-
|
|
|
|
|
46 |
|
47 |
-
if
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
if __name__ == "__main__":
|
57 |
demo.launch(share=True)
|
|
|
41 |
import gradio as gr
|
42 |
from gradio_model4dgs import Model4DGS
|
43 |
import os
|
44 |
+
from PIL import Image
|
45 |
+
import hashlib
|
46 |
|
47 |
+
def check_img_input(control_image):
|
48 |
+
if control_image is None:
|
49 |
+
raise gr.Error("Please select or upload an input image")
|
50 |
|
51 |
+
if __name__ == "__main__":
|
52 |
+
_TITLE = '''DreamGaussian: Generative Gaussian Splatting for Efficient 3D Content Creation'''
|
53 |
+
|
54 |
+
_DESCRIPTION = '''
|
55 |
+
<div>
|
56 |
+
<a style="display:inline-block" href="https://jiawei-ren.github.io/projects/dreamgaussian4d/"><img src='https://img.shields.io/badge/public_website-8A2BE2'></a>
|
57 |
+
<a style="display:inline-block; margin-left: .5em" href="https://arxiv.org/abs/2312.17142"><img src="https://img.shields.io/badge/2309.16653-f9f7f7?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADcAAABMCAYAAADJPi9EAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAuIwAALiMBeKU/dgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vu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AcQONYSUQRxW/QMrHZVIyik0ZuQA2mzp+Ji8BW4YM3Mbzm9inaHkJCGfrUZZjujiYailfFwA8DHIy3acwUj4v9vUVa+SmgNsl5fuyDTKovW9/IAmfLV0Pi2UncA515kjYdrwC9i9rpuHiq3JwtAAAAABJRU5ErkJggg=="></a>
|
58 |
+
<a style="display:inline-block; margin-left: .5em" href='https://github.com/jiawei-ren/dreamgaussian4d'><img src='https://img.shields.io/github/stars/jiawei-ren/dreamgaussian4d?style=social'/></a>
|
59 |
+
</div>
|
60 |
+
We introduce DreamGaussian4D, an efficient 4D generation framework that builds on 4D Gaussian Splatting representation.
|
61 |
+
'''
|
62 |
+
|
63 |
+
# load images in 'assets' folder as examples
|
64 |
+
image_dir = os.path.join(os.path.dirname(__file__), "assets")
|
65 |
+
examples_img = None
|
66 |
+
|
67 |
+
if os.path.exists(image_dir) and os.path.isdir(image_dir) and os.listdir(image_dir):
|
68 |
+
examples_4d = [os.path.join(image_dir, file) for file in os.listdir(image_dir) if file.endswith('.ply')]
|
69 |
+
examples_img = [os.path.join(image_dir, file) for file in os.listdir(image_dir) if file.endswith('.png')]
|
70 |
+
else:
|
71 |
+
examples_4d = [os.path.join(os.path.dirname(__file__), example) for example in Model4DGS().example_inputs()]
|
72 |
+
|
73 |
+
def optimize(image_block: Image.Image):
|
74 |
+
# temporarily only show tiger
|
75 |
+
return f'{os.path.join(os.path.dirname(__file__), "logs")}/tiger.glb', examples_4d
|
76 |
+
|
77 |
+
# Compose demo layout & data flow
|
78 |
+
with gr.Blocks(title=_TITLE, theme=gr.themes.Soft()) as demo:
|
79 |
+
with gr.Row():
|
80 |
+
with gr.Column(scale=1):
|
81 |
+
gr.Markdown('# ' + _TITLE)
|
82 |
+
gr.Markdown(_DESCRIPTION)
|
83 |
+
|
84 |
+
with gr.Row(variant='panel'):
|
85 |
+
left_column = gr.Column(scale=5)
|
86 |
+
with left_column:
|
87 |
+
image_block = gr.Image(type='pil', image_mode='RGBA', height=290, label='Input image')
|
88 |
+
|
89 |
+
preprocess_chk = gr.Checkbox(True,
|
90 |
+
label='Preprocess image automatically (remove background and recenter object)')
|
91 |
+
|
92 |
+
with gr.Column(scale=5):
|
93 |
+
obj3d = gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="3D Model (Final)")
|
94 |
+
obj4d = Model4DGS(label="4D Model")
|
95 |
+
|
96 |
+
with left_column:
|
97 |
+
gr.Examples(
|
98 |
+
examples=examples_img, # NOTE: elements must match inputs list!
|
99 |
+
inputs=image_block,
|
100 |
+
outputs=obj3d,
|
101 |
+
fn=optimize,
|
102 |
+
label='Examples (click one of the images below to start)',
|
103 |
+
examples_per_page=40
|
104 |
+
)
|
105 |
+
img_run_btn = gr.Button("Generate 4D")
|
106 |
+
|
107 |
+
# if there is an input image, continue with inference
|
108 |
+
# else display an error message
|
109 |
+
img_run_btn.click(check_img_input, inputs=[image_block], queue=False).success(
|
110 |
+
optimize, inputs=[image_block], outputs=[obj3d, obj4d])
|
111 |
|
112 |
if __name__ == "__main__":
|
113 |
demo.launch(share=True)
|