Dylan Ebert
commited on
Commit
·
dec9ec5
1
Parent(s):
c5edef0
model3d component
Browse files
app.py
CHANGED
@@ -189,21 +189,16 @@ def process(input_image, prompt, prompt_neg='', input_elevation=0, input_num_ste
|
|
189 |
images = np.concatenate(images, axis=0)
|
190 |
imageio.mimwrite(output_video_path, images, fps=30)
|
191 |
|
192 |
-
return
|
193 |
|
194 |
# gradio UI
|
195 |
|
196 |
-
_TITLE = '''LGM
|
197 |
|
198 |
_DESCRIPTION = '''
|
199 |
<div>
|
200 |
-
<a
|
201 |
-
<a style="display:inline-block; margin-left: .5em" href="https://github.com/3DTopia/LGM"><img src='https://img.shields.io/github/stars/3DTopia/LGM?style=social'/></a>
|
202 |
</div>
|
203 |
-
|
204 |
-
* Input can be only text, only image, or both image and text.
|
205 |
-
* Output is a `ply` file containing the 3D Gaussians, please check our [repo](https://github.com/3DTopia/LGM/blob/main/readme.md) for visualization and mesh conversion.
|
206 |
-
* If you find the output unsatisfying, try using different seeds!
|
207 |
'''
|
208 |
|
209 |
block = gr.Blocks(title=_TITLE).queue()
|
@@ -232,16 +227,10 @@ with block:
|
|
232 |
|
233 |
|
234 |
with gr.Column(scale=1):
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
output_file = gr.File(label="3D Gaussians (ply format)")
|
240 |
-
with gr.Tab("Multi-view Image"):
|
241 |
-
# multi-view results
|
242 |
-
output_image = gr.Image(interactive=False, show_label=False)
|
243 |
-
|
244 |
-
button_gen.click(process, inputs=[input_image, input_text, input_neg_text, input_elevation, input_num_steps, input_seed], outputs=[output_image, output_video, output_file])
|
245 |
|
246 |
gr.Examples(
|
247 |
examples=[
|
@@ -253,7 +242,7 @@ with block:
|
|
253 |
"data_test/gso_rabbit.jpg",
|
254 |
],
|
255 |
inputs=[input_image],
|
256 |
-
outputs=[
|
257 |
fn=lambda x: process(input_image=x, prompt=''),
|
258 |
cache_examples=True,
|
259 |
label='Image-to-3D Examples'
|
@@ -270,7 +259,7 @@ with block:
|
|
270 |
|
271 |
],
|
272 |
inputs=[input_text],
|
273 |
-
outputs=[
|
274 |
fn=lambda x: process(input_image=None, prompt=x),
|
275 |
cache_examples=True,
|
276 |
label='Text-to-3D Examples'
|
|
|
189 |
images = np.concatenate(images, axis=0)
|
190 |
imageio.mimwrite(output_video_path, images, fps=30)
|
191 |
|
192 |
+
return output_ply_path, output_ply_path
|
193 |
|
194 |
# gradio UI
|
195 |
|
196 |
+
_TITLE = '''LGM Mini'''
|
197 |
|
198 |
_DESCRIPTION = '''
|
199 |
<div>
|
200 |
+
A lightweight version of <a href="https://huggingface.co/spaces/ashawkey/LGM">LGM: Large Multi-View Gaussian Model for High-Resolution 3D Content Creation</a>
|
|
|
201 |
</div>
|
|
|
|
|
|
|
|
|
202 |
'''
|
203 |
|
204 |
block = gr.Blocks(title=_TITLE).queue()
|
|
|
227 |
|
228 |
|
229 |
with gr.Column(scale=1):
|
230 |
+
output_splat = gr.Model3D(label="3D Gaussians")
|
231 |
+
output_file = gr.File(label="3D Gaussians (ply format)")
|
232 |
+
|
233 |
+
button_gen.click(process, inputs=[input_image, input_text, input_neg_text, input_elevation, input_num_steps, input_seed], outputs=[output_splat, output_file])
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
|
235 |
gr.Examples(
|
236 |
examples=[
|
|
|
242 |
"data_test/gso_rabbit.jpg",
|
243 |
],
|
244 |
inputs=[input_image],
|
245 |
+
outputs=[output_splat, output_file],
|
246 |
fn=lambda x: process(input_image=x, prompt=''),
|
247 |
cache_examples=True,
|
248 |
label='Image-to-3D Examples'
|
|
|
259 |
|
260 |
],
|
261 |
inputs=[input_text],
|
262 |
+
outputs=[output_splat, output_file],
|
263 |
fn=lambda x: process(input_image=None, prompt=x),
|
264 |
cache_examples=True,
|
265 |
label='Text-to-3D Examples'
|