Spaces:
Runtime error
Runtime error
amankishore
commited on
Commit
·
f845bf6
1
Parent(s):
e43a382
Update python version
Browse files
README.md
CHANGED
@@ -4,6 +4,7 @@ emoji: 🚀
|
|
4 |
colorFrom: yellow
|
5 |
colorTo: green
|
6 |
sdk: gradio
|
|
|
7 |
sdk_version: 3.28.2
|
8 |
app_file: app.py
|
9 |
pinned: true
|
|
|
4 |
colorFrom: yellow
|
5 |
colorTo: green
|
6 |
sdk: gradio
|
7 |
+
python_version: 3.10
|
8 |
sdk_version: 3.28.2
|
9 |
app_file: app.py
|
10 |
pinned: true
|
app.py
CHANGED
@@ -69,7 +69,8 @@ def generate_3D(input, grid_size=64):
|
|
69 |
diffusion = diffusion_from_config(load_config('diffusion'))
|
70 |
batch_size = 4
|
71 |
|
72 |
-
|
|
|
73 |
|
74 |
if isinstance(input, Image.Image):
|
75 |
input = prepare_img(input)
|
@@ -114,7 +115,7 @@ def generate_3D(input, grid_size=64):
|
|
114 |
|
115 |
tm=rm.tri_mesh()
|
116 |
|
117 |
-
with open("
|
118 |
tm.write_ply(f)
|
119 |
|
120 |
|
@@ -129,11 +130,10 @@ def generate_3D(input, grid_size=64):
|
|
129 |
images = decode_latent_images(xm, latents[0], cameras, rendering_mode=render_mode)
|
130 |
|
131 |
# Convert images to gif
|
132 |
-
|
133 |
-
images[0].save(f'/tmp/mesh.mp4', save_all=True, append_images=images[1:], duration=100, loop=0)
|
134 |
|
135 |
|
136 |
-
return ply_to_glb('/tmp/mesh.ply', '/tmp/mesh.glb'), '/tmp/mesh.
|
137 |
|
138 |
def prepare_img(img):
|
139 |
|
@@ -198,6 +198,8 @@ with block:
|
|
198 |
<a class="duplicate-button" style="display:inline-block" target="_blank" href="https://huggingface.co/spaces/MirageML/point-e?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a>
|
199 |
</div>
|
200 |
<br />
|
|
|
|
|
201 |
<p style="margin-bottom: 10px; font-size: 94%">
|
202 |
Generate 3D Assets in 1 minute with a prompt or image!
|
203 |
Based on the <a href="https://github.com/openai/shap-e">Shap-E</a> implementation
|
@@ -220,6 +222,8 @@ with block:
|
|
220 |
<a class="duplicate-button" style="display:inline-block" target="_blank" href="https://huggingface.co/spaces/MirageML/point-e?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a>
|
221 |
</div>
|
222 |
<br />
|
|
|
|
|
223 |
<p style="margin-bottom: 10px; font-size: 94%">
|
224 |
Generate 3D Assets in 1 minute with a prompt or image!
|
225 |
Based on the <a href="https://github.com/openai/shap-e">Shap-E</a> implementation
|
@@ -261,6 +265,16 @@ with block:
|
|
261 |
fn=generate_3D,
|
262 |
cache_examples=True
|
263 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
|
265 |
img_button.click(fn=generate_3D, inputs=[input_image], outputs=[model_3d, model_gif, file_out])
|
266 |
text_button.click(fn=generate_3D, inputs=[prompt], outputs=[model_3d, model_gif, file_out])
|
|
|
69 |
diffusion = diffusion_from_config(load_config('diffusion'))
|
70 |
batch_size = 4
|
71 |
|
72 |
+
if isinstance(input, np.ndarray):
|
73 |
+
input = Image.fromarray(input)
|
74 |
|
75 |
if isinstance(input, Image.Image):
|
76 |
input = prepare_img(input)
|
|
|
115 |
|
116 |
tm=rm.tri_mesh()
|
117 |
|
118 |
+
with open("/tmp/mesh.ply",'wb') as f:
|
119 |
tm.write_ply(f)
|
120 |
|
121 |
|
|
|
130 |
images = decode_latent_images(xm, latents[0], cameras, rendering_mode=render_mode)
|
131 |
|
132 |
# Convert images to gif
|
133 |
+
images[0].save(f'/tmp/mesh.gif', save_all=True, append_images=images[1:], duration=100, loop=0)
|
|
|
134 |
|
135 |
|
136 |
+
return ply_to_glb('/tmp/mesh.ply', '/tmp/mesh.glb'), '/tmp/mesh.gif', gr.update(value=['/tmp/mesh.glb', '/tmp/mesh.ply'], visible=True)
|
137 |
|
138 |
def prepare_img(img):
|
139 |
|
|
|
198 |
<a class="duplicate-button" style="display:inline-block" target="_blank" href="https://huggingface.co/spaces/MirageML/point-e?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a>
|
199 |
</div>
|
200 |
<br />
|
201 |
+
If the Queue is Too Long, <a href="https://app.mirageml.com/generate" style="text-decoration: underline" target="_blank">Try it on Mirage</a>!
|
202 |
+
<br />
|
203 |
<p style="margin-bottom: 10px; font-size: 94%">
|
204 |
Generate 3D Assets in 1 minute with a prompt or image!
|
205 |
Based on the <a href="https://github.com/openai/shap-e">Shap-E</a> implementation
|
|
|
222 |
<a class="duplicate-button" style="display:inline-block" target="_blank" href="https://huggingface.co/spaces/MirageML/point-e?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a>
|
223 |
</div>
|
224 |
<br />
|
225 |
+
If the Queue is Too Long, <a href="https://app.mirageml.com/generate" style="text-decoration: underline" target="_blank">Try it on Mirage</a>!
|
226 |
+
<br />
|
227 |
<p style="margin-bottom: 10px; font-size: 94%">
|
228 |
Generate 3D Assets in 1 minute with a prompt or image!
|
229 |
Based on the <a href="https://github.com/openai/shap-e">Shap-E</a> implementation
|
|
|
265 |
fn=generate_3D,
|
266 |
cache_examples=True
|
267 |
)
|
268 |
+
gr.Examples(
|
269 |
+
examples=[
|
270 |
+
["a shark"],
|
271 |
+
["an avocado"],
|
272 |
+
],
|
273 |
+
inputs=[prompt],
|
274 |
+
outputs=[model_3d, model_gif, file_out],
|
275 |
+
fn=generate_3D,
|
276 |
+
cache_examples=True
|
277 |
+
)
|
278 |
|
279 |
img_button.click(fn=generate_3D, inputs=[input_image], outputs=[model_3d, model_gif, file_out])
|
280 |
text_button.click(fn=generate_3D, inputs=[prompt], outputs=[model_3d, model_gif, file_out])
|