fffiloni commited on
Commit
ac6a0bc
1 Parent(s): 3ea1832

display 3d models

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -155,7 +155,7 @@ def process_image(input_pil, remove_bg):
155
  shutil.rmtree(temp_dir) # Cleanup temporary folder
156
  print(output_video)
157
  torch.cuda.empty_cache()
158
- return output_video[0], output_objects
159
 
160
  css="""
161
  div#col-container{
@@ -197,7 +197,7 @@ def gradio_interface():
197
  label="Image input",
198
  type="pil",
199
  image_mode="RGBA",
200
- height=240
201
  )
202
 
203
  remove_bg = gr.Checkbox(label="Need to remove BG ?", value=False)
@@ -206,7 +206,9 @@ def gradio_interface():
206
 
207
  with gr.Column(scale=4):
208
  output_video= gr.Video(label="Output Video", elem_id="video-out-elm")
209
- output_objects = gr.Files(label=".OBJ outputs")
 
 
210
 
211
  gr.Examples(
212
  examples = examples_folder,
@@ -214,7 +216,7 @@ def gradio_interface():
214
  examples_per_page = 11
215
  )
216
 
217
- submit_button.click(process_image, inputs=[input_image, remove_bg], outputs=[output_video, output_objects])
218
 
219
  return app
220
 
 
155
  shutil.rmtree(temp_dir) # Cleanup temporary folder
156
  print(output_video)
157
  torch.cuda.empty_cache()
158
+ return output_video[0], output_objects[1], output_objects[0]
159
 
160
  css="""
161
  div#col-container{
 
197
  label="Image input",
198
  type="pil",
199
  image_mode="RGBA",
200
+ height=480
201
  )
202
 
203
  remove_bg = gr.Checkbox(label="Need to remove BG ?", value=False)
 
206
 
207
  with gr.Column(scale=4):
208
  output_video= gr.Video(label="Output Video", elem_id="video-out-elm")
209
+ with gr.Row():
210
+ output_object_mesh = gr.Model3D(label=".OBJ Mesh")
211
+ output_object_color = gr.Model3D(label=".OBJ colored")
212
 
213
  gr.Examples(
214
  examples = examples_folder,
 
216
  examples_per_page = 11
217
  )
218
 
219
+ submit_button.click(process_image, inputs=[input_image, remove_bg], outputs=[output_video, output_object_mesh, output_object_color])
220
 
221
  return app
222