Update app.py
Browse files
app.py
CHANGED
|
@@ -36,7 +36,7 @@ import os
|
|
| 36 |
import argparse
|
| 37 |
from omegaconf import OmegaConf
|
| 38 |
from rembg import remove
|
| 39 |
-
from collections import defaultdict
|
| 40 |
from engine.pose_estimation.pose_estimator import PoseEstimator
|
| 41 |
from LHM.utils.face_detector import VGGHeadDetector
|
| 42 |
from LHM.utils.hf_hub import wrap_model_hub
|
|
@@ -640,8 +640,8 @@ def demo_lhm(pose_estimator, face_detector, lhm, cfg):
|
|
| 640 |
)
|
| 641 |
|
| 642 |
# # export ply model
|
| 643 |
-
print(dump_model_path)
|
| 644 |
-
gs_model_list[0].save_ply(dump_model_path)
|
| 645 |
|
| 646 |
# rendering !!!!
|
| 647 |
start_time = time.time()
|
|
@@ -728,8 +728,8 @@ def demo_lhm(pose_estimator, face_detector, lhm, cfg):
|
|
| 728 |
)
|
| 729 |
|
| 730 |
|
| 731 |
-
return dump_image_path, dump_video_path, dump_model_path
|
| 732 |
-
|
| 733 |
# return rgb, dump_image_path, dump_video_path
|
| 734 |
|
| 735 |
# def core_fn_export(image, video_params, working_dir):
|
|
@@ -860,28 +860,26 @@ def demo_lhm(pose_estimator, face_detector, lhm, cfg):
|
|
| 860 |
|
| 861 |
# show video && ply model
|
| 862 |
with gr.Row():
|
| 863 |
-
with gr.Column(variant='panel', scale=1):
|
| 864 |
-
|
| 865 |
-
|
| 866 |
-
|
| 867 |
-
|
| 868 |
|
| 869 |
with gr.Column(variant='panel', scale=1):
|
| 870 |
with gr.Tabs(elem_id="openlrm_render_video"):
|
| 871 |
with gr.TabItem('Rendered Video'):
|
| 872 |
with gr.Row():
|
| 873 |
output_video = gr.Video(label="Rendered Video", format="mp4", height=480, width=270, autoplay=True)
|
| 874 |
-
|
| 875 |
-
|
| 876 |
-
|
| 877 |
-
model_download_link = gr.File(label="3D Model File", interactive=False)
|
| 878 |
|
| 879 |
-
download_btn.click(
|
| 880 |
-
|
| 881 |
-
|
| 882 |
-
|
| 883 |
-
)
|
| 884 |
-
|
| 885 |
working_dir = gr.State()
|
| 886 |
submit.click(
|
| 887 |
fn=assert_input_image,
|
|
@@ -895,6 +893,7 @@ def demo_lhm(pose_estimator, face_detector, lhm, cfg):
|
|
| 895 |
fn=core_fn,
|
| 896 |
inputs=[input_image, video_input, working_dir], # video_params refer to smpl dir
|
| 897 |
outputs=[processed_image, output_video, output_model],
|
|
|
|
| 898 |
)
|
| 899 |
|
| 900 |
demo.queue(max_size=1)
|
|
|
|
| 36 |
import argparse
|
| 37 |
from omegaconf import OmegaConf
|
| 38 |
from rembg import remove
|
| 39 |
+
# from collections import defaultdict
|
| 40 |
from engine.pose_estimation.pose_estimator import PoseEstimator
|
| 41 |
from LHM.utils.face_detector import VGGHeadDetector
|
| 42 |
from LHM.utils.hf_hub import wrap_model_hub
|
|
|
|
| 640 |
)
|
| 641 |
|
| 642 |
# # export ply model
|
| 643 |
+
# print(dump_model_path)
|
| 644 |
+
# gs_model_list[0].save_ply(dump_model_path)
|
| 645 |
|
| 646 |
# rendering !!!!
|
| 647 |
start_time = time.time()
|
|
|
|
| 728 |
)
|
| 729 |
|
| 730 |
|
| 731 |
+
# return dump_image_path, dump_video_path, dump_model_path
|
| 732 |
+
return dump_image_path, dump_video_path
|
| 733 |
# return rgb, dump_image_path, dump_video_path
|
| 734 |
|
| 735 |
# def core_fn_export(image, video_params, working_dir):
|
|
|
|
| 860 |
|
| 861 |
# show video && ply model
|
| 862 |
with gr.Row():
|
| 863 |
+
# with gr.Column(variant='panel', scale=1):
|
| 864 |
+
# with gr.Tabs(elem_id="openlrm_render_model"):
|
| 865 |
+
# with gr.TabItem('Rendered 3D Model'):
|
| 866 |
+
# with gr.Row():
|
| 867 |
+
# output_model = gr.Model3D(label="Rendered 3D Model")
|
| 868 |
|
| 869 |
with gr.Column(variant='panel', scale=1):
|
| 870 |
with gr.Tabs(elem_id="openlrm_render_video"):
|
| 871 |
with gr.TabItem('Rendered Video'):
|
| 872 |
with gr.Row():
|
| 873 |
output_video = gr.Video(label="Rendered Video", format="mp4", height=480, width=270, autoplay=True)
|
| 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 |
working_dir = gr.State()
|
| 884 |
submit.click(
|
| 885 |
fn=assert_input_image,
|
|
|
|
| 893 |
fn=core_fn,
|
| 894 |
inputs=[input_image, video_input, working_dir], # video_params refer to smpl dir
|
| 895 |
outputs=[processed_image, output_video, output_model],
|
| 896 |
+
# outputs=[processed_image, output_video, output_model],
|
| 897 |
)
|
| 898 |
|
| 899 |
demo.queue(max_size=1)
|