Update app.py
Browse files
app.py
CHANGED
@@ -50,7 +50,7 @@ def handle_motion_generation(npy1,npy2):
|
|
50 |
config = get_config(config_path)
|
51 |
ae = get_autoencoder(config)
|
52 |
ae.load_state_dict(torch.load(checkpoint_path))
|
53 |
-
ae.cuda()
|
54 |
ae.eval()
|
55 |
mean_pose, std_pose = get_meanpose("test", config.data)
|
56 |
# print("loaded model")
|
@@ -60,16 +60,18 @@ def handle_motion_generation(npy1,npy2):
|
|
60 |
|
61 |
os.makedirs(out_dir_path, exist_ok=True)
|
62 |
|
63 |
-
|
64 |
-
|
65 |
out_path1 = os.path.join(out_dir_path, "adv.npy")
|
66 |
|
67 |
|
68 |
x_a, x_a_start = load_and_preprocess(path1, config, mean_pose, std_pose)
|
69 |
x_b, x_b_start = load_and_preprocess(path2, config, mean_pose, std_pose)
|
70 |
|
71 |
-
x_a_batch = x_a.unsqueeze(0).cuda()
|
72 |
-
x_b_batch = x_b.unsqueeze(0).cuda()
|
|
|
|
|
73 |
|
74 |
x_ab = ae.cross2d(x_a_batch, x_b_batch, x_a_batch)
|
75 |
x_ab = postprocess(x_ab, mean_pose, std_pose, config.data.unit, start=x_a_start)
|
@@ -88,7 +90,6 @@ def handle_motion_generation(npy1,npy2):
|
|
88 |
motion2video(motion_data, height, width, save_path, colors, bg_color=bg_color, transparency=False, fps=fps)
|
89 |
first_frame_image = Image.open('./an-frames/0000.png')
|
90 |
return first_frame_image
|
91 |
-
# print('hi')
|
92 |
|
93 |
with gr.Blocks() as demo:
|
94 |
gr.Markdown("Upload two `.npy` files to generate motion and visualize the first frame of the output animation.")
|
|
|
50 |
config = get_config(config_path)
|
51 |
ae = get_autoencoder(config)
|
52 |
ae.load_state_dict(torch.load(checkpoint_path))
|
53 |
+
# ae.cuda()
|
54 |
ae.eval()
|
55 |
mean_pose, std_pose = get_meanpose("test", config.data)
|
56 |
# print("loaded model")
|
|
|
60 |
|
61 |
os.makedirs(out_dir_path, exist_ok=True)
|
62 |
|
63 |
+
path1 = './data/1.npy'
|
64 |
+
path2 = './data/2.npy'
|
65 |
out_path1 = os.path.join(out_dir_path, "adv.npy")
|
66 |
|
67 |
|
68 |
x_a, x_a_start = load_and_preprocess(path1, config, mean_pose, std_pose)
|
69 |
x_b, x_b_start = load_and_preprocess(path2, config, mean_pose, std_pose)
|
70 |
|
71 |
+
# x_a_batch = x_a.unsqueeze(0).cuda()
|
72 |
+
# x_b_batch = x_b.unsqueeze(0).cuda()
|
73 |
+
x_a_batch = x_a.unsqueeze(0)
|
74 |
+
x_b_batch = x_b.unsqueeze(0)
|
75 |
|
76 |
x_ab = ae.cross2d(x_a_batch, x_b_batch, x_a_batch)
|
77 |
x_ab = postprocess(x_ab, mean_pose, std_pose, config.data.unit, start=x_a_start)
|
|
|
90 |
motion2video(motion_data, height, width, save_path, colors, bg_color=bg_color, transparency=False, fps=fps)
|
91 |
first_frame_image = Image.open('./an-frames/0000.png')
|
92 |
return first_frame_image
|
|
|
93 |
|
94 |
with gr.Blocks() as demo:
|
95 |
gr.Markdown("Upload two `.npy` files to generate motion and visualize the first frame of the output animation.")
|