replaced a set of images with a Gallery

#2
by ysharma HF staff - opened
Files changed (1) hide show
  1. app.py +5 -17
app.py CHANGED
@@ -232,7 +232,7 @@ def run_pipeline(pipeline, cfg, single_image, guidance_scale, steps, seed, crop_
232
  images_pred = [save_image(images_pred[i]) for i in range(bsz)]
233
 
234
  out = images_pred + normals_pred
235
- return out
236
 
237
 
238
  def process_3d(mode, data_dir, guidance_scale, crop_size):
@@ -391,28 +391,16 @@ def run_demo():
391
  # gr.Markdown("<span style='color:red'>First click Generate button, then click Reconstruct button. Reconstruction may cost several minutes.</span>")
392
 
393
  with gr.Row():
394
- view_1 = gr.Image(interactive=False, height=512, show_label=False)
395
- view_2 = gr.Image(interactive=False, height=512, show_label=False)
396
- view_3 = gr.Image(interactive=False, height=512, show_label=False)
397
- with gr.Row():
398
- view_4 = gr.Image(interactive=False, height=512, show_label=False)
399
- view_5 = gr.Image(interactive=False, height=512, show_label=False)
400
- view_6 = gr.Image(interactive=False, height=512, show_label=False)
401
- with gr.Row():
402
- normal_1 = gr.Image(interactive=False, height=512, show_label=False)
403
- normal_2 = gr.Image(interactive=False, height=512, show_label=False)
404
- normal_3 = gr.Image(interactive=False, height=512, show_label=False)
405
- with gr.Row():
406
- normal_4 = gr.Image(interactive=False, height=512, show_label=False)
407
- normal_5 = gr.Image(interactive=False, height=512, show_label=False)
408
- normal_6 = gr.Image(interactive=False, height=512, show_label=False)
409
  print('Launching...')
410
  run_btn.click(
411
  fn=partial(preprocess, predictor), inputs=[input_image, input_processing], outputs=[processed_image_highres, processed_image], queue=True
412
  ).success(
413
  fn=partial(run_pipeline, pipeline, cfg),
414
  inputs=[processed_image_highres, scale_slider, steps_slider, seed, crop_size, output_processing],
415
- outputs=[view_1, view_2, view_3, view_4, view_5, view_6, normal_1, normal_2, normal_3, normal_4, normal_5, normal_6],
416
  )
417
  # recon_btn.click(
418
  # process_3d, inputs=[mode, data_dir, scale_slider, crop_size], outputs=[obj_3d]
 
232
  images_pred = [save_image(images_pred[i]) for i in range(bsz)]
233
 
234
  out = images_pred + normals_pred
235
+ return images_pred, normals_pred
236
 
237
 
238
  def process_3d(mode, data_dir, guidance_scale, crop_size):
 
391
  # gr.Markdown("<span style='color:red'>First click Generate button, then click Reconstruct button. Reconstruction may cost several minutes.</span>")
392
 
393
  with gr.Row():
394
+ view_gallery = gr.Gallery(label='Multiview Images')
395
+ normal_gallery = gr.Gallery(label='Multiview Normals')
396
+
 
 
 
 
 
 
 
 
 
 
 
 
397
  print('Launching...')
398
  run_btn.click(
399
  fn=partial(preprocess, predictor), inputs=[input_image, input_processing], outputs=[processed_image_highres, processed_image], queue=True
400
  ).success(
401
  fn=partial(run_pipeline, pipeline, cfg),
402
  inputs=[processed_image_highres, scale_slider, steps_slider, seed, crop_size, output_processing],
403
+ outputs=[view_gallery, normal_gallery],
404
  )
405
  # recon_btn.click(
406
  # process_3d, inputs=[mode, data_dir, scale_slider, crop_size], outputs=[obj_3d]