Spaces:
Build error
Build error
Commit
·
35a8822
1
Parent(s):
055110b
Minor
Browse files
app.py
CHANGED
|
@@ -215,6 +215,7 @@ def generate(
|
|
| 215 |
pred_motions = vq_model.forward_decoder(mids)
|
| 216 |
pred_motions = pred_motions.detach().cpu().numpy()
|
| 217 |
data = inv_transform(pred_motions)
|
|
|
|
| 218 |
for k, (caption, joint_data) in enumerate(zip(captions, data)):
|
| 219 |
animation_path = pjoin(cached_dir, f'{uid}')
|
| 220 |
shutil.rmtree(animation_path)
|
|
@@ -222,7 +223,7 @@ def generate(
|
|
| 222 |
joint_data = joint_data[:m_length[k]]
|
| 223 |
joint = recover_from_ric(torch.from_numpy(joint_data).float(), 22).numpy()
|
| 224 |
bvh_path = pjoin(animation_path, "sample_repeat%d.bvh" % (r))
|
| 225 |
-
save_path = pjoin(animation_path, "sample_repeat%d.mp4"%(r))
|
| 226 |
if use_ik:
|
| 227 |
_, joint = converter.convert(joint, filename=bvh_path, iterations=100)
|
| 228 |
else:
|
|
@@ -230,7 +231,7 @@ def generate(
|
|
| 230 |
plot_3d_motion(save_path, kinematic_chain, joint, title=caption, fps=20)
|
| 231 |
np.save(pjoin(animation_path, "sample_repeat%d.npy"%(r)), joint)
|
| 232 |
data_unit = {
|
| 233 |
-
"url": pjoin(animation_path, "sample_repeat%d.mp4"%(r))
|
| 234 |
}
|
| 235 |
datas.append(data_unit)
|
| 236 |
|
|
|
|
| 215 |
pred_motions = vq_model.forward_decoder(mids)
|
| 216 |
pred_motions = pred_motions.detach().cpu().numpy()
|
| 217 |
data = inv_transform(pred_motions)
|
| 218 |
+
ruid = random.randrange(99999)
|
| 219 |
for k, (caption, joint_data) in enumerate(zip(captions, data)):
|
| 220 |
animation_path = pjoin(cached_dir, f'{uid}')
|
| 221 |
shutil.rmtree(animation_path)
|
|
|
|
| 223 |
joint_data = joint_data[:m_length[k]]
|
| 224 |
joint = recover_from_ric(torch.from_numpy(joint_data).float(), 22).numpy()
|
| 225 |
bvh_path = pjoin(animation_path, "sample_repeat%d.bvh" % (r))
|
| 226 |
+
save_path = pjoin(animation_path, "sample_repeat%d_%d.mp4"%(r, ruid))
|
| 227 |
if use_ik:
|
| 228 |
_, joint = converter.convert(joint, filename=bvh_path, iterations=100)
|
| 229 |
else:
|
|
|
|
| 231 |
plot_3d_motion(save_path, kinematic_chain, joint, title=caption, fps=20)
|
| 232 |
np.save(pjoin(animation_path, "sample_repeat%d.npy"%(r)), joint)
|
| 233 |
data_unit = {
|
| 234 |
+
"url": pjoin(animation_path, "sample_repeat%d_%d.mp4"%(r, ruid))
|
| 235 |
}
|
| 236 |
datas.append(data_unit)
|
| 237 |
|