Spaces:
Alexspy19
/
Runtime error

Alexspy19 commited on
Commit
273bd41
·
verified ·
1 Parent(s): 5fd5a4a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -10
app.py CHANGED
@@ -639,8 +639,8 @@ def demo_lhm(pose_estimator, face_detector, lhm, cfg):
639
  )
640
 
641
  # # export ply model
642
- # print(dump_model_path)
643
- # gs_model_list[0].save_ply(dump_model_path)
644
 
645
  # rendering !!!!
646
  start_time = time.time()
@@ -727,8 +727,8 @@ def demo_lhm(pose_estimator, face_detector, lhm, cfg):
727
  )
728
 
729
 
730
-
731
- return dump_image_path, dump_video_path
732
  # return rgb, dump_image_path, dump_video_path
733
 
734
  # def core_fn_export(image, video_params, working_dir):
@@ -859,11 +859,11 @@ def demo_lhm(pose_estimator, face_detector, lhm, cfg):
859
 
860
  # show video && ply model
861
  with gr.Row():
862
- # with gr.Column(variant='panel', scale=1):
863
- # with gr.Tabs(elem_id="openlrm_render_model"):
864
- # with gr.TabItem('Rendered 3D Model'):
865
- # with gr.Row():
866
- # output_model = gr.Model3D(label="Rendered 3D Model")
867
 
868
  with gr.Column(variant='panel', scale=1):
869
  with gr.Tabs(elem_id="openlrm_render_video"):
@@ -871,6 +871,16 @@ def demo_lhm(pose_estimator, face_detector, lhm, cfg):
871
  with gr.Row():
872
  output_video = gr.Video(label="Rendered Video", format="mp4", height=480, width=270, autoplay=True)
873
 
 
 
 
 
 
 
 
 
 
 
874
  working_dir = gr.State()
875
  submit.click(
876
  fn=assert_input_image,
@@ -883,7 +893,7 @@ def demo_lhm(pose_estimator, face_detector, lhm, cfg):
883
  ).success(
884
  fn=core_fn,
885
  inputs=[input_image, video_input, working_dir], # video_params refer to smpl dir
886
- outputs=[processed_image, output_video],
887
  )
888
 
889
  demo.queue(max_size=1)
 
639
  )
640
 
641
  # # export ply model
642
+ print(dump_model_path)
643
+ gs_model_list[0].save_ply(dump_model_path)
644
 
645
  # rendering !!!!
646
  start_time = time.time()
 
727
  )
728
 
729
 
730
+ return dump_image_path, dump_video_path, dump_model_path
731
+ # return dump_image_path, dump_video_path
732
  # return rgb, dump_image_path, dump_video_path
733
 
734
  # def core_fn_export(image, video_params, working_dir):
 
859
 
860
  # show video && ply model
861
  with gr.Row():
862
+ with gr.Column(variant='panel', scale=1):
863
+ with gr.Tabs(elem_id="openlrm_render_model"):
864
+ with gr.TabItem('Rendered 3D Model'):
865
+ with gr.Row():
866
+ output_model = gr.Model3D(label="Rendered 3D Model")
867
 
868
  with gr.Column(variant='panel', scale=1):
869
  with gr.Tabs(elem_id="openlrm_render_video"):
 
871
  with gr.Row():
872
  output_video = gr.Video(label="Rendered Video", format="mp4", height=480, width=270, autoplay=True)
873
 
874
+ with gr.Row():
875
+ download_btn = gr.Button("Download 3D Model")
876
+ model_download_link = gr.File(label="3D Model File", interactive=False)
877
+
878
+ download_btn.click(
879
+ fn=lambda x: x if x else None,
880
+ inputs=[output_model],
881
+ outputs=[model_download_link]
882
+ )
883
+
884
  working_dir = gr.State()
885
  submit.click(
886
  fn=assert_input_image,
 
893
  ).success(
894
  fn=core_fn,
895
  inputs=[input_image, video_input, working_dir], # video_params refer to smpl dir
896
+ outputs=[processed_image, output_video, output_model],
897
  )
898
 
899
  demo.queue(max_size=1)