Spaces:
Runtime error
Runtime error
kleinhe
commited on
Commit
·
50a02f4
1
Parent(s):
73ba0a5
speed
Browse files
app.py
CHANGED
@@ -9,9 +9,10 @@ css = """
|
|
9 |
|
10 |
from huggingface_hub import snapshot_download
|
11 |
from motion.visual_api import Visualize
|
12 |
-
import
|
13 |
import torch
|
14 |
import json
|
|
|
15 |
|
16 |
with open("motion/path.json", "r") as f:
|
17 |
json_dict = json.load(f)
|
@@ -61,7 +62,8 @@ def demo(prompt, mode, condition, render_mode="joints", skip_steps=0, out_size=1
|
|
61 |
render_mode = render_mode
|
62 |
|
63 |
joint_path = "results/joints/{}_joint.npy".format(mode[i])
|
64 |
-
smpl_path = "results/
|
|
|
65 |
|
66 |
output = visual.predict(prompt, path, render_mode, joint_path, smpl_path)
|
67 |
|
@@ -71,20 +73,23 @@ def demo(prompt, mode, condition, render_mode="joints", skip_steps=0, out_size=1
|
|
71 |
meshes, _ = visual.get_mesh(output)
|
72 |
pics = visual.pyrender_process(meshes, out_size, out_size)
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
|
|
77 |
|
78 |
if mode[i] == "cadm":
|
79 |
-
out_paths[0] =
|
80 |
joints_paths[0] = joint_path
|
81 |
smpl_paths[0] = smpl_path
|
82 |
elif mode[i] == "cadm-augment":
|
83 |
-
out_paths[1] =
|
84 |
joints_paths[1] = joint_path
|
85 |
smpl_paths[1] = smpl_path
|
86 |
elif mode[i] == "mdm":
|
87 |
-
out_paths[2] =
|
88 |
joints_paths[2] = joint_path
|
89 |
smpl_paths[2] = smpl_path
|
90 |
|
|
|
9 |
|
10 |
from huggingface_hub import snapshot_download
|
11 |
from motion.visual_api import Visualize
|
12 |
+
import cv2
|
13 |
import torch
|
14 |
import json
|
15 |
+
from tqdm import tqdm
|
16 |
|
17 |
with open("motion/path.json", "r") as f:
|
18 |
json_dict = json.load(f)
|
|
|
62 |
render_mode = render_mode
|
63 |
|
64 |
joint_path = "results/joints/{}_joint.npy".format(mode[i])
|
65 |
+
smpl_path = "results/smpls/{}_smpl.npy".format(mode[i])
|
66 |
+
video_path = "results/motion/{}_video.mp4".format(mode[i])
|
67 |
|
68 |
output = visual.predict(prompt, path, render_mode, joint_path, smpl_path)
|
69 |
|
|
|
73 |
meshes, _ = visual.get_mesh(output)
|
74 |
pics = visual.pyrender_process(meshes, out_size, out_size)
|
75 |
|
76 |
+
video=cv2.VideoWriter(video_path,cv2.VideoWriter_fourcc(*'MP4V'),20,(out_size, out_size))
|
77 |
+
for pic in tqdm(pics):
|
78 |
+
pic = pic[:, :, :3]
|
79 |
+
pic = cv2.cvtColor(pic, cv2.COLOR_BGR2RGB)
|
80 |
+
video.write(pic) #写入视频
|
81 |
+
video.release()
|
82 |
|
83 |
if mode[i] == "cadm":
|
84 |
+
out_paths[0] = video_path
|
85 |
joints_paths[0] = joint_path
|
86 |
smpl_paths[0] = smpl_path
|
87 |
elif mode[i] == "cadm-augment":
|
88 |
+
out_paths[1] = video_path
|
89 |
joints_paths[1] = joint_path
|
90 |
smpl_paths[1] = smpl_path
|
91 |
elif mode[i] == "mdm":
|
92 |
+
out_paths[2] = video_path
|
93 |
joints_paths[2] = joint_path
|
94 |
smpl_paths[2] = smpl_path
|
95 |
|