Dylan Ebert commited on
Commit
dec9ec5
1 Parent(s): c5edef0

model3d component

Browse files
Files changed (1) hide show
  1. app.py +9 -20
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 mv_image_grid, output_video_path, output_ply_path
193
 
194
  # gradio UI
195
 
196
- _TITLE = '''LGM: Large Multi-View Gaussian Model for High-Resolution 3D Content Creation'''
197
 
198
  _DESCRIPTION = '''
199
  <div>
200
- <a style="display:inline-block" href="https://me.kiui.moe/lgm/"><img src='https://img.shields.io/badge/public_website-8A2BE2'></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
- with gr.Tab("Video"):
236
- # final video results
237
- output_video = gr.Video(label="video")
238
- # ply file
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=[output_image, output_video, output_file],
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=[output_image, output_video, output_file],
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'