oneScotch commited on
Commit ·
1409738
1
Parent(s): 8998cf5
stream last processed frame
Browse files
app.py
CHANGED
|
@@ -48,6 +48,7 @@ def infer(video_input, in_threshold=0.5, num_people="Single person", render_mesh
|
|
| 48 |
frame += 1
|
| 49 |
img, mesh_paths, smplx_paths = inferer.infer(original_img, in_threshold, frame, multi_person, not(render_mesh))
|
| 50 |
video_output.write(img)
|
|
|
|
| 51 |
cap.release()
|
| 52 |
video_output.release()
|
| 53 |
cv2.destroyAllWindows()
|
|
@@ -62,7 +63,7 @@ def infer(video_input, in_threshold=0.5, num_people="Single person", render_mesh
|
|
| 62 |
os.makedirs(save_path_smplx, exist_ok= True)
|
| 63 |
os.system(f'zip -r {save_mesh_file} {save_path_mesh}')
|
| 64 |
os.system(f'zip -r {save_smplx_file} {save_path_smplx}')
|
| 65 |
-
|
| 66 |
|
| 67 |
TITLE = '''<h1 align="center">SMPLer-X: Scaling Up Expressive Human Pose and Shape Estimation</h1>'''
|
| 68 |
VIDEO = '''
|
|
@@ -108,12 +109,13 @@ with gr.Blocks(title="SMPLer-X", css=".gradio-container") as demo:
|
|
| 108 |
|
| 109 |
with gr.Row():
|
| 110 |
with gr.Column():
|
|
|
|
| 111 |
video_output = gr.Video(elem_classes="video")
|
| 112 |
with gr.Column():
|
| 113 |
meshes_output = gr.File(label="3D meshes")
|
| 114 |
smplx_output = gr.File(label= "SMPL-X models")
|
| 115 |
# example_images = gr.Examples([])
|
| 116 |
-
send_button.click(fn=infer, inputs=[video_input, threshold, num_people, mesh_as_vertices], outputs=[video_output, meshes_output, smplx_output])
|
| 117 |
# with gr.Row():
|
| 118 |
example_videos = gr.Examples([
|
| 119 |
['/home/user/app/assets/01.mp4'],
|
|
|
|
| 48 |
frame += 1
|
| 49 |
img, mesh_paths, smplx_paths = inferer.infer(original_img, in_threshold, frame, multi_person, not(render_mesh))
|
| 50 |
video_output.write(img)
|
| 51 |
+
yield img, None, None, None
|
| 52 |
cap.release()
|
| 53 |
video_output.release()
|
| 54 |
cv2.destroyAllWindows()
|
|
|
|
| 63 |
os.makedirs(save_path_smplx, exist_ok= True)
|
| 64 |
os.system(f'zip -r {save_mesh_file} {save_path_mesh}')
|
| 65 |
os.system(f'zip -r {save_smplx_file} {save_path_smplx}')
|
| 66 |
+
yield img, video_path, save_mesh_file, save_smplx_file
|
| 67 |
|
| 68 |
TITLE = '''<h1 align="center">SMPLer-X: Scaling Up Expressive Human Pose and Shape Estimation</h1>'''
|
| 69 |
VIDEO = '''
|
|
|
|
| 109 |
|
| 110 |
with gr.Row():
|
| 111 |
with gr.Column():
|
| 112 |
+
processed_frames = gr.Image(label="last frame")
|
| 113 |
video_output = gr.Video(elem_classes="video")
|
| 114 |
with gr.Column():
|
| 115 |
meshes_output = gr.File(label="3D meshes")
|
| 116 |
smplx_output = gr.File(label= "SMPL-X models")
|
| 117 |
# example_images = gr.Examples([])
|
| 118 |
+
send_button.click(fn=infer, inputs=[video_input, threshold, num_people, mesh_as_vertices], outputs=[processed_frames, video_output, meshes_output, smplx_output])
|
| 119 |
# with gr.Row():
|
| 120 |
example_videos = gr.Examples([
|
| 121 |
['/home/user/app/assets/01.mp4'],
|