Spaces:
Running
on
Zero
Running
on
Zero
update app.py
Browse files
app.py
CHANGED
|
@@ -372,6 +372,7 @@ def demo_lhm(pose_estimator, face_detector, lhm, cfg):
|
|
| 372 |
|
| 373 |
dump_video_path = os.path.join(working_dir.name, "output.mp4")
|
| 374 |
dump_image_path = os.path.join(working_dir.name, "output.png")
|
|
|
|
| 375 |
|
| 376 |
|
| 377 |
# prepare dump paths
|
|
@@ -513,6 +514,10 @@ def demo_lhm(pose_estimator, face_detector, lhm, cfg):
|
|
| 513 |
},
|
| 514 |
)
|
| 515 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 516 |
# rendering !!!!
|
| 517 |
start_time = time.time()
|
| 518 |
batch_dict = dict()
|
|
@@ -597,6 +602,8 @@ def demo_lhm(pose_estimator, face_detector, lhm, cfg):
|
|
| 597 |
verbose=True,
|
| 598 |
)
|
| 599 |
|
|
|
|
|
|
|
| 600 |
return dump_image_path, dump_video_path
|
| 601 |
# return rgb, dump_image_path, dump_video_path
|
| 602 |
|
|
@@ -687,7 +694,6 @@ def demo_lhm(pose_estimator, face_detector, lhm, cfg):
|
|
| 687 |
inputs=[input_image],
|
| 688 |
examples_per_page=20,
|
| 689 |
)
|
| 690 |
-
|
| 691 |
with gr.Column():
|
| 692 |
with gr.Tabs(elem_id="openlrm_input_video"):
|
| 693 |
with gr.TabItem('Input Video'):
|
|
@@ -719,17 +725,24 @@ def demo_lhm(pose_estimator, face_detector, lhm, cfg):
|
|
| 719 |
with gr.Row():
|
| 720 |
processed_image = gr.Image(label="Processed Image", image_mode="RGBA", type="filepath", elem_id="processed_image", height=480, width=270, interactive=False)
|
| 721 |
|
| 722 |
-
with gr.Column(variant='panel', scale=1):
|
| 723 |
-
with gr.Tabs(elem_id="openlrm_render_video"):
|
| 724 |
-
with gr.TabItem('Rendered Video'):
|
| 725 |
-
with gr.Row():
|
| 726 |
-
output_video = gr.Video(label="Rendered Video", format="mp4", height=480, width=270, autoplay=True)
|
| 727 |
-
|
| 728 |
# SETTING
|
| 729 |
with gr.Row():
|
| 730 |
with gr.Column(variant='panel', scale=1):
|
| 731 |
submit = gr.Button('Generate', elem_id="openlrm_generate", variant='primary')
|
| 732 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 733 |
|
| 734 |
working_dir = gr.State()
|
| 735 |
submit.click(
|
|
@@ -785,6 +798,6 @@ def launch_gradio_app():
|
|
| 785 |
demo_lhm(pose_estimator, facedetector, lhm, cfg)
|
| 786 |
|
| 787 |
if __name__ == '__main__':
|
| 788 |
-
launch_pretrained()
|
| 789 |
# launch_env_not_compile_with_cuda()
|
| 790 |
launch_gradio_app()
|
|
|
|
| 372 |
|
| 373 |
dump_video_path = os.path.join(working_dir.name, "output.mp4")
|
| 374 |
dump_image_path = os.path.join(working_dir.name, "output.png")
|
| 375 |
+
dump_model_path = os.path.join(working_dir.name, "output.ply")
|
| 376 |
|
| 377 |
|
| 378 |
# prepare dump paths
|
|
|
|
| 514 |
},
|
| 515 |
)
|
| 516 |
|
| 517 |
+
# # export ply model
|
| 518 |
+
# print(dump_model_path)
|
| 519 |
+
# gs_model_list[0].save_ply(dump_model_path)
|
| 520 |
+
|
| 521 |
# rendering !!!!
|
| 522 |
start_time = time.time()
|
| 523 |
batch_dict = dict()
|
|
|
|
| 602 |
verbose=True,
|
| 603 |
)
|
| 604 |
|
| 605 |
+
|
| 606 |
+
|
| 607 |
return dump_image_path, dump_video_path
|
| 608 |
# return rgb, dump_image_path, dump_video_path
|
| 609 |
|
|
|
|
| 694 |
inputs=[input_image],
|
| 695 |
examples_per_page=20,
|
| 696 |
)
|
|
|
|
| 697 |
with gr.Column():
|
| 698 |
with gr.Tabs(elem_id="openlrm_input_video"):
|
| 699 |
with gr.TabItem('Input Video'):
|
|
|
|
| 725 |
with gr.Row():
|
| 726 |
processed_image = gr.Image(label="Processed Image", image_mode="RGBA", type="filepath", elem_id="processed_image", height=480, width=270, interactive=False)
|
| 727 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 728 |
# SETTING
|
| 729 |
with gr.Row():
|
| 730 |
with gr.Column(variant='panel', scale=1):
|
| 731 |
submit = gr.Button('Generate', elem_id="openlrm_generate", variant='primary')
|
| 732 |
|
| 733 |
+
# show video && ply model
|
| 734 |
+
with gr.Row():
|
| 735 |
+
# with gr.Column(variant='panel', scale=1):
|
| 736 |
+
# with gr.Tabs(elem_id="openlrm_render_model"):
|
| 737 |
+
# with gr.TabItem('Rendered 3D Model'):
|
| 738 |
+
# with gr.Row():
|
| 739 |
+
# output_model = gr.Model3D(label="Rendered 3D Model")
|
| 740 |
+
|
| 741 |
+
with gr.Column(variant='panel', scale=1):
|
| 742 |
+
with gr.Tabs(elem_id="openlrm_render_video"):
|
| 743 |
+
with gr.TabItem('Rendered Video'):
|
| 744 |
+
with gr.Row():
|
| 745 |
+
output_video = gr.Video(label="Rendered Video", format="mp4", height=480, width=270, autoplay=True)
|
| 746 |
|
| 747 |
working_dir = gr.State()
|
| 748 |
submit.click(
|
|
|
|
| 798 |
demo_lhm(pose_estimator, facedetector, lhm, cfg)
|
| 799 |
|
| 800 |
if __name__ == '__main__':
|
| 801 |
+
# launch_pretrained()
|
| 802 |
# launch_env_not_compile_with_cuda()
|
| 803 |
launch_gradio_app()
|