LTT commited on
Commit
e6eeff6
1 Parent(s): f7bdeab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -35
app.py CHANGED
@@ -322,36 +322,36 @@ def make3d(images):
322
  planes = model.forward_planes(images, input_cameras)
323
 
324
  # # get video
325
- # chunk_size = 20 if IS_FLEXICUBES else 1
326
- # render_size = 512
327
 
328
- # frames = []
329
- # frames, albedos, pbr_spec_lights, pbr_diffuse_lights, normals, alphas = render_frames(
330
- # model,
331
- # planes,
332
- # render_cameras=all_mvp,
333
- # camera_pos=all_campos,
334
- # env=ENV,
335
- # materials=materials,
336
- # render_size=render_size,
337
- # chunk_size=chunk_size,
338
- # is_flexicubes=IS_FLEXICUBES,
339
- # )
340
- # normals = (torch.nn.functional.normalize(normals) + 1) / 2
341
- # normals = normals * alphas + (1-alphas)
342
- # all_frames = torch.cat([frames, albedos, pbr_spec_lights, pbr_diffuse_lights, normals], dim=3)
343
 
344
- # images_to_video(
345
- # all_frames,
346
- # video_fpath,
347
- # fps=30,
348
- # )
349
 
350
- # print(f"Video saved to {video_fpath}")
351
 
352
  mesh_fpath, mesh_glb_fpath = make_mesh(mesh_fpath, planes)
353
- return mesh_fpath, mesh_glb_fpath
354
- # return video_fpath, mesh_fpath, mesh_glb_fpath
355
 
356
 
357
  import gradio as gr
@@ -450,14 +450,14 @@ with gr.Blocks() as demo:
450
  interactive=False
451
  )
452
 
453
- # with gr.Column():
454
- # with gr.Column():
455
- # output_video = gr.Video(
456
- # label="video", format="mp4",
457
- # width=768,
458
- # autoplay=True,
459
- # interactive=False
460
- # )
461
 
462
  with gr.Row():
463
  with gr.Tab("OBJ"):
@@ -492,8 +492,8 @@ with gr.Blocks() as demo:
492
  ).success(
493
  fn=make3d,
494
  inputs=[mv_images],
495
- outputs=[output_model_obj, output_model_glb]
496
- # outputs=[output_video, output_model_obj, output_model_glb]
497
  )
498
 
499
  # demo.queue(max_size=10)
 
322
  planes = model.forward_planes(images, input_cameras)
323
 
324
  # # get video
325
+ chunk_size = 20 if IS_FLEXICUBES else 1
326
+ render_size = 512
327
 
328
+ frames = []
329
+ frames, albedos, pbr_spec_lights, pbr_diffuse_lights, normals, alphas = render_frames(
330
+ model,
331
+ planes,
332
+ render_cameras=all_mvp,
333
+ camera_pos=all_campos,
334
+ env=ENV,
335
+ materials=materials,
336
+ render_size=render_size,
337
+ chunk_size=chunk_size,
338
+ is_flexicubes=IS_FLEXICUBES,
339
+ )
340
+ normals = (torch.nn.functional.normalize(normals) + 1) / 2
341
+ normals = normals * alphas + (1-alphas)
342
+ all_frames = torch.cat([frames, albedos, pbr_spec_lights, pbr_diffuse_lights, normals], dim=3)
343
 
344
+ images_to_video(
345
+ all_frames,
346
+ video_fpath,
347
+ fps=30,
348
+ )
349
 
350
+ print(f"Video saved to {video_fpath}")
351
 
352
  mesh_fpath, mesh_glb_fpath = make_mesh(mesh_fpath, planes)
353
+ # return mesh_fpath, mesh_glb_fpath
354
+ return video_fpath, mesh_fpath, mesh_glb_fpath
355
 
356
 
357
  import gradio as gr
 
450
  interactive=False
451
  )
452
 
453
+ with gr.Column():
454
+ with gr.Column():
455
+ output_video = gr.Video(
456
+ label="video", format="mp4",
457
+ width=768,
458
+ autoplay=True,
459
+ interactive=False
460
+ )
461
 
462
  with gr.Row():
463
  with gr.Tab("OBJ"):
 
492
  ).success(
493
  fn=make3d,
494
  inputs=[mv_images],
495
+ # outputs=[output_model_obj, output_model_glb]
496
+ outputs=[output_video, output_model_obj, output_model_glb]
497
  )
498
 
499
  # demo.queue(max_size=10)