Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,17 @@
|
|
| 1 |
import os
|
| 2 |
import random
|
|
|
|
| 3 |
from datetime import datetime
|
| 4 |
-
|
| 5 |
import gradio as gr
|
| 6 |
import numpy as np
|
| 7 |
import torch
|
| 8 |
from diffusers import AutoencoderKL, DDIMScheduler
|
| 9 |
from einops import repeat
|
| 10 |
-
from huggingface_hub import
|
| 11 |
from omegaconf import OmegaConf
|
| 12 |
from PIL import Image
|
| 13 |
from torchvision import transforms
|
| 14 |
from transformers import CLIPVisionModelWithProjection
|
| 15 |
-
|
| 16 |
from src.models.pose_guider import PoseGuider
|
| 17 |
from src.models.unet_2d_condition import UNet2DConditionModel
|
| 18 |
from src.models.unet_3d import UNet3DConditionModel
|
|
@@ -20,85 +19,39 @@ from src.pipelines.pipeline_pose2vid_long import Pose2VideoPipeline
|
|
| 20 |
from src.utils.download_models import prepare_base_model, prepare_image_encoder
|
| 21 |
from src.utils.util import get_fps, read_frames, save_videos_grid
|
| 22 |
|
| 23 |
-
# Partial download
|
| 24 |
prepare_base_model()
|
| 25 |
prepare_image_encoder()
|
| 26 |
-
|
| 27 |
-
snapshot_download(
|
| 28 |
-
repo_id="stabilityai/sd-vae-ft-mse", local_dir="./pretrained_weights/sd-vae-ft-mse"
|
| 29 |
-
)
|
| 30 |
-
snapshot_download(
|
| 31 |
-
repo_id="patrolli/AnimateAnyone",
|
| 32 |
-
local_dir="./pretrained_weights",
|
| 33 |
-
)
|
| 34 |
-
|
| 35 |
|
| 36 |
class AnimateController:
|
| 37 |
-
def __init__(
|
| 38 |
-
self,
|
| 39 |
-
config_path="./configs/prompts/animation.yaml",
|
| 40 |
-
weight_dtype=torch.float16,
|
| 41 |
-
):
|
| 42 |
-
# Read pretrained weights path from config
|
| 43 |
self.config = OmegaConf.load(config_path)
|
| 44 |
self.pipeline = None
|
| 45 |
self.weight_dtype = weight_dtype
|
| 46 |
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
ref_image,
|
| 50 |
-
pose_video_path,
|
| 51 |
-
width=512,
|
| 52 |
-
height=768,
|
| 53 |
-
length=24,
|
| 54 |
-
num_inference_steps=25,
|
| 55 |
-
cfg=3.5,
|
| 56 |
-
seed=123,
|
| 57 |
-
):
|
| 58 |
generator = torch.manual_seed(seed)
|
| 59 |
if isinstance(ref_image, np.ndarray):
|
| 60 |
ref_image = Image.fromarray(ref_image)
|
| 61 |
if self.pipeline is None:
|
| 62 |
-
vae = AutoencoderKL.from_pretrained(
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
reference_unet = UNet2DConditionModel.from_pretrained(
|
| 67 |
-
self.config.pretrained_base_model_path,
|
| 68 |
-
subfolder="unet",
|
| 69 |
-
).to(dtype=self.weight_dtype, device="cuda")
|
| 70 |
-
|
| 71 |
-
inference_config_path = self.config.inference_config
|
| 72 |
-
infer_config = OmegaConf.load(inference_config_path)
|
| 73 |
denoising_unet = UNet3DConditionModel.from_pretrained_2d(
|
| 74 |
self.config.pretrained_base_model_path,
|
| 75 |
self.config.motion_module_path,
|
| 76 |
subfolder="unet",
|
| 77 |
unet_additional_kwargs=infer_config.unet_additional_kwargs,
|
| 78 |
).to(dtype=self.weight_dtype, device="cuda")
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
dtype=self.weight_dtype, device="cuda"
|
| 82 |
-
)
|
| 83 |
-
|
| 84 |
-
image_enc = CLIPVisionModelWithProjection.from_pretrained(
|
| 85 |
-
self.config.image_encoder_path
|
| 86 |
-
).to(dtype=self.weight_dtype, device="cuda")
|
| 87 |
sched_kwargs = OmegaConf.to_container(infer_config.noise_scheduler_kwargs)
|
| 88 |
scheduler = DDIMScheduler(**sched_kwargs)
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
torch.load(self.config.denoising_unet_path, map_location="cpu"),
|
| 93 |
-
strict=False,
|
| 94 |
-
)
|
| 95 |
-
reference_unet.load_state_dict(
|
| 96 |
-
torch.load(self.config.reference_unet_path, map_location="cpu"),
|
| 97 |
-
)
|
| 98 |
-
pose_guider.load_state_dict(
|
| 99 |
-
torch.load(self.config.pose_guider_path, map_location="cpu"),
|
| 100 |
-
)
|
| 101 |
-
|
| 102 |
pipe = Pose2VideoPipeline(
|
| 103 |
vae=vae,
|
| 104 |
image_encoder=image_enc,
|
|
@@ -112,12 +65,10 @@ class AnimateController:
|
|
| 112 |
|
| 113 |
pose_images = read_frames(pose_video_path)
|
| 114 |
src_fps = get_fps(pose_video_path)
|
| 115 |
-
|
| 116 |
pose_list = []
|
| 117 |
total_length = min(length, len(pose_images))
|
| 118 |
for pose_image_pil in pose_images[:total_length]:
|
| 119 |
pose_list.append(pose_image_pil)
|
| 120 |
-
|
| 121 |
video = self.pipeline(
|
| 122 |
ref_image,
|
| 123 |
pose_list,
|
|
@@ -130,44 +81,28 @@ class AnimateController:
|
|
| 130 |
).videos
|
| 131 |
|
| 132 |
new_h, new_w = video.shape[-2:]
|
| 133 |
-
pose_transform = transforms.Compose(
|
| 134 |
-
[transforms.Resize((new_h, new_w)), transforms.ToTensor()]
|
| 135 |
-
)
|
| 136 |
pose_tensor_list = []
|
| 137 |
for pose_image_pil in pose_images[:total_length]:
|
| 138 |
pose_tensor_list.append(pose_transform(pose_image_pil))
|
| 139 |
|
| 140 |
-
ref_image_tensor = pose_transform(ref_image)
|
| 141 |
-
ref_image_tensor =
|
| 142 |
-
|
| 143 |
-
ref_image_tensor, "b c f h w -> b c (repeat f) h w", repeat=total_length
|
| 144 |
-
)
|
| 145 |
-
pose_tensor = torch.stack(pose_tensor_list, dim=0) # (f, c, h, w)
|
| 146 |
-
pose_tensor = pose_tensor.transpose(0, 1)
|
| 147 |
-
pose_tensor = pose_tensor.unsqueeze(0)
|
| 148 |
video = torch.cat([ref_image_tensor, pose_tensor, video], dim=0)
|
| 149 |
|
| 150 |
-
save_dir =
|
| 151 |
if not os.path.exists(save_dir):
|
| 152 |
os.makedirs(save_dir, exist_ok=True)
|
| 153 |
date_str = datetime.now().strftime("%Y%m%d")
|
| 154 |
time_str = datetime.now().strftime("%H%M")
|
| 155 |
out_path = os.path.join(save_dir, f"{date_str}T{time_str}.mp4")
|
| 156 |
-
save_videos_grid(
|
| 157 |
-
video,
|
| 158 |
-
out_path,
|
| 159 |
-
n_rows=3,
|
| 160 |
-
fps=src_fps,
|
| 161 |
-
)
|
| 162 |
-
|
| 163 |
torch.cuda.empty_cache()
|
| 164 |
-
|
| 165 |
return out_path
|
| 166 |
|
| 167 |
-
|
| 168 |
controller = AnimateController()
|
| 169 |
|
| 170 |
-
|
| 171 |
def ui():
|
| 172 |
with gr.Blocks() as demo:
|
| 173 |
gr.HTML(
|
|
@@ -177,127 +112,47 @@ def ui():
|
|
| 177 |
</h1>
|
| 178 |
<div style="text-align:center">
|
| 179 |
<div style="display: inline-block; text-align: left;">
|
| 180 |
-
<p>
|
| 181 |
-
<p>
|
| 182 |
</div>
|
| 183 |
</div>
|
| 184 |
"""
|
| 185 |
)
|
| 186 |
-
animation = gr.Video(
|
| 187 |
-
format="mp4",
|
| 188 |
-
label="Animation Results",
|
| 189 |
-
height=448,
|
| 190 |
-
autoplay=True,
|
| 191 |
-
)
|
| 192 |
-
|
| 193 |
with gr.Row():
|
| 194 |
reference_image = gr.Image(label="Reference Image")
|
| 195 |
-
motion_sequence = gr.Video(
|
| 196 |
-
format="mp4", label="Motion Sequence", height=512
|
| 197 |
-
)
|
| 198 |
-
|
| 199 |
with gr.Column():
|
| 200 |
-
width_slider = gr.Slider(
|
| 201 |
-
|
| 202 |
-
)
|
| 203 |
-
height_slider = gr.Slider(
|
| 204 |
-
label="Height", minimum=512, maximum=960, value=768, step=64
|
| 205 |
-
)
|
| 206 |
-
length_slider = gr.Slider(
|
| 207 |
-
label="Video Length", minimum=24, maximum=128, value=72, step=24
|
| 208 |
-
)
|
| 209 |
with gr.Row():
|
| 210 |
seed_textbox = gr.Textbox(label="Seed", value=-1)
|
| 211 |
-
seed_button = gr.Button(
|
| 212 |
-
|
| 213 |
-
)
|
| 214 |
-
seed_button.click(
|
| 215 |
-
fn=lambda: gr.Textbox.update(value=random.randint(1, 1e8)),
|
| 216 |
-
inputs=[],
|
| 217 |
-
outputs=[seed_textbox],
|
| 218 |
-
)
|
| 219 |
with gr.Row():
|
| 220 |
-
sampling_steps = gr.Slider(
|
| 221 |
-
|
| 222 |
-
value=15,
|
| 223 |
-
info="default: 15",
|
| 224 |
-
step=5,
|
| 225 |
-
maximum=20,
|
| 226 |
-
minimum=10,
|
| 227 |
-
)
|
| 228 |
-
guidance_scale = gr.Slider(
|
| 229 |
-
label="Guidance scale",
|
| 230 |
-
value=3.5,
|
| 231 |
-
info="default: 3.5",
|
| 232 |
-
step=0.5,
|
| 233 |
-
maximum=6.5,
|
| 234 |
-
minimum=2.0,
|
| 235 |
-
)
|
| 236 |
submit = gr.Button("Animate")
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
return video
|
| 240 |
-
|
| 241 |
-
def read_image(image):
|
| 242 |
-
return Image.fromarray(image)
|
| 243 |
-
|
| 244 |
-
# when user uploads a new video
|
| 245 |
-
motion_sequence.upload(
|
| 246 |
-
read_video, motion_sequence, motion_sequence, queue=False
|
| 247 |
-
)
|
| 248 |
-
# when `first_frame` is updated
|
| 249 |
-
reference_image.upload(
|
| 250 |
-
read_image, reference_image, reference_image, queue=False
|
| 251 |
-
)
|
| 252 |
-
# when the `submit` button is clicked
|
| 253 |
submit.click(
|
| 254 |
controller.animate,
|
| 255 |
-
[
|
| 256 |
-
reference_image,
|
| 257 |
-
motion_sequence,
|
| 258 |
-
width_slider,
|
| 259 |
-
height_slider,
|
| 260 |
-
length_slider,
|
| 261 |
-
sampling_steps,
|
| 262 |
-
guidance_scale,
|
| 263 |
-
seed_textbox,
|
| 264 |
-
],
|
| 265 |
animation,
|
| 266 |
)
|
| 267 |
-
|
| 268 |
-
# Examples
|
| 269 |
gr.Markdown("## Examples")
|
| 270 |
gr.Examples(
|
| 271 |
examples=[
|
| 272 |
-
[
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
512,
|
| 276 |
-
768,
|
| 277 |
-
72,
|
| 278 |
-
],
|
| 279 |
-
[
|
| 280 |
-
"./configs/inference/ref_images/anyone-10.png",
|
| 281 |
-
"./configs/inference/pose_videos/anyone-video-1_kps.mp4",
|
| 282 |
-
512,
|
| 283 |
-
768,
|
| 284 |
-
72,
|
| 285 |
-
],
|
| 286 |
-
[
|
| 287 |
-
"./configs/inference/ref_images/anyone-2.png",
|
| 288 |
-
"./configs/inference/pose_videos/anyone-video-5_kps.mp4",
|
| 289 |
-
512,
|
| 290 |
-
768,
|
| 291 |
-
72,
|
| 292 |
-
],
|
| 293 |
],
|
| 294 |
inputs=[reference_image, motion_sequence, width_slider, height_slider, length_slider],
|
| 295 |
outputs=animation,
|
| 296 |
)
|
| 297 |
-
|
| 298 |
return demo
|
| 299 |
|
| 300 |
-
|
| 301 |
demo = ui()
|
| 302 |
demo.queue(max_size=10)
|
| 303 |
demo.launch(share=True, show_api=False)
|
|
|
|
| 1 |
import os
|
| 2 |
import random
|
| 3 |
+
import spaces
|
| 4 |
from datetime import datetime
|
|
|
|
| 5 |
import gradio as gr
|
| 6 |
import numpy as np
|
| 7 |
import torch
|
| 8 |
from diffusers import AutoencoderKL, DDIMScheduler
|
| 9 |
from einops import repeat
|
| 10 |
+
from huggingface_hub import snapshot_download
|
| 11 |
from omegaconf import OmegaConf
|
| 12 |
from PIL import Image
|
| 13 |
from torchvision import transforms
|
| 14 |
from transformers import CLIPVisionModelWithProjection
|
|
|
|
| 15 |
from src.models.pose_guider import PoseGuider
|
| 16 |
from src.models.unet_2d_condition import UNet2DConditionModel
|
| 17 |
from src.models.unet_3d import UNet3DConditionModel
|
|
|
|
| 19 |
from src.utils.download_models import prepare_base_model, prepare_image_encoder
|
| 20 |
from src.utils.util import get_fps, read_frames, save_videos_grid
|
| 21 |
|
|
|
|
| 22 |
prepare_base_model()
|
| 23 |
prepare_image_encoder()
|
| 24 |
+
snapshot_download(repo_id="stabilityai/sd-vae-ft-mse", local_dir="./pretrained_weights/sd-vae-ft-mse")
|
| 25 |
+
snapshot_download(repo_id="patrolli/AnimateAnyone", local_dir="./pretrained_weights")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
class AnimateController:
|
| 28 |
+
def __init__(self, config_path="./configs/prompts/animation.yaml", weight_dtype=torch.float16):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
self.config = OmegaConf.load(config_path)
|
| 30 |
self.pipeline = None
|
| 31 |
self.weight_dtype = weight_dtype
|
| 32 |
|
| 33 |
+
@spaces.GPU(duration=60)
|
| 34 |
+
def animate(self, ref_image, pose_video_path, width=512, height=768, length=24, num_inference_steps=25, cfg=3.5, seed=123):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
generator = torch.manual_seed(seed)
|
| 36 |
if isinstance(ref_image, np.ndarray):
|
| 37 |
ref_image = Image.fromarray(ref_image)
|
| 38 |
if self.pipeline is None:
|
| 39 |
+
vae = AutoencoderKL.from_pretrained(self.config.pretrained_vae_path).to("cuda", dtype=self.weight_dtype)
|
| 40 |
+
reference_unet = UNet2DConditionModel.from_pretrained(self.config.pretrained_base_model_path, subfolder="unet").to(dtype=self.weight_dtype, device="cuda")
|
| 41 |
+
infer_config = OmegaConf.load(self.config.inference_config)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
denoising_unet = UNet3DConditionModel.from_pretrained_2d(
|
| 43 |
self.config.pretrained_base_model_path,
|
| 44 |
self.config.motion_module_path,
|
| 45 |
subfolder="unet",
|
| 46 |
unet_additional_kwargs=infer_config.unet_additional_kwargs,
|
| 47 |
).to(dtype=self.weight_dtype, device="cuda")
|
| 48 |
+
pose_guider = PoseGuider(320, block_out_channels=(16, 32, 96, 256)).to(dtype=self.weight_dtype, device="cuda")
|
| 49 |
+
image_enc = CLIPVisionModelWithProjection.from_pretrained(self.config.image_encoder_path).to(dtype=self.weight_dtype, device="cuda")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
sched_kwargs = OmegaConf.to_container(infer_config.noise_scheduler_kwargs)
|
| 51 |
scheduler = DDIMScheduler(**sched_kwargs)
|
| 52 |
+
denoising_unet.load_state_dict(torch.load(self.config.denoising_unet_path, map_location="cpu"), strict=False)
|
| 53 |
+
reference_unet.load_state_dict(torch.load(self.config.reference_unet_path, map_location="cpu"))
|
| 54 |
+
pose_guider.load_state_dict(torch.load(self.config.pose_guider_path, map_location="cpu"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
pipe = Pose2VideoPipeline(
|
| 56 |
vae=vae,
|
| 57 |
image_encoder=image_enc,
|
|
|
|
| 65 |
|
| 66 |
pose_images = read_frames(pose_video_path)
|
| 67 |
src_fps = get_fps(pose_video_path)
|
|
|
|
| 68 |
pose_list = []
|
| 69 |
total_length = min(length, len(pose_images))
|
| 70 |
for pose_image_pil in pose_images[:total_length]:
|
| 71 |
pose_list.append(pose_image_pil)
|
|
|
|
| 72 |
video = self.pipeline(
|
| 73 |
ref_image,
|
| 74 |
pose_list,
|
|
|
|
| 81 |
).videos
|
| 82 |
|
| 83 |
new_h, new_w = video.shape[-2:]
|
| 84 |
+
pose_transform = transforms.Compose([transforms.Resize((new_h, new_w)), transforms.ToTensor()])
|
|
|
|
|
|
|
| 85 |
pose_tensor_list = []
|
| 86 |
for pose_image_pil in pose_images[:total_length]:
|
| 87 |
pose_tensor_list.append(pose_transform(pose_image_pil))
|
| 88 |
|
| 89 |
+
ref_image_tensor = pose_transform(ref_image).unsqueeze(1).unsqueeze(0)
|
| 90 |
+
ref_image_tensor = repeat(ref_image_tensor, "b c f h w -> b c (repeat f) h w", repeat=total_length)
|
| 91 |
+
pose_tensor = torch.stack(pose_tensor_list, dim=0).transpose(0, 1).unsqueeze(0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
video = torch.cat([ref_image_tensor, pose_tensor, video], dim=0)
|
| 93 |
|
| 94 |
+
save_dir = "./output/gradio"
|
| 95 |
if not os.path.exists(save_dir):
|
| 96 |
os.makedirs(save_dir, exist_ok=True)
|
| 97 |
date_str = datetime.now().strftime("%Y%m%d")
|
| 98 |
time_str = datetime.now().strftime("%H%M")
|
| 99 |
out_path = os.path.join(save_dir, f"{date_str}T{time_str}.mp4")
|
| 100 |
+
save_videos_grid(video, out_path, n_rows=3, fps=src_fps)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
torch.cuda.empty_cache()
|
|
|
|
| 102 |
return out_path
|
| 103 |
|
|
|
|
| 104 |
controller = AnimateController()
|
| 105 |
|
|
|
|
| 106 |
def ui():
|
| 107 |
with gr.Blocks() as demo:
|
| 108 |
gr.HTML(
|
|
|
|
| 112 |
</h1>
|
| 113 |
<div style="text-align:center">
|
| 114 |
<div style="display: inline-block; text-align: left;">
|
| 115 |
+
<p>This is a quick preview demo of Moore-AnimateAnyone. We appreciate the assistance provided by the HuggingFace team in setting up this demo.</p>
|
| 116 |
+
<p>If you like this project, please consider giving a star on <a herf="https://github.com/MooreThreads/Moore-AnimateAnyone">our GitHub repo</a> 🤗.</p>
|
| 117 |
</div>
|
| 118 |
</div>
|
| 119 |
"""
|
| 120 |
)
|
| 121 |
+
animation = gr.Video(format="mp4", label="Animation Results", height=448, autoplay=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
with gr.Row():
|
| 123 |
reference_image = gr.Image(label="Reference Image")
|
| 124 |
+
motion_sequence = gr.Video(format="mp4", label="Motion Sequence", height=512)
|
|
|
|
|
|
|
|
|
|
| 125 |
with gr.Column():
|
| 126 |
+
width_slider = gr.Slider(label="Width", minimum=448, maximum=768, value=512, step=64)
|
| 127 |
+
height_slider = gr.Slider(label="Height", minimum=512, maximum=960, value=768, step=64)
|
| 128 |
+
length_slider = gr.Slider(label="Video Length", minimum=24, maximum=128, value=72, step=24)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
with gr.Row():
|
| 130 |
seed_textbox = gr.Textbox(label="Seed", value=-1)
|
| 131 |
+
seed_button = gr.Button(value="\U0001F3B2", elem_classes="toolbutton")
|
| 132 |
+
seed_button.click(fn=lambda: gr.Textbox.update(value=random.randint(1, 1e8)), inputs=[], outputs=[seed_textbox])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
with gr.Row():
|
| 134 |
+
sampling_steps = gr.Slider(label="Sampling steps", value=15, info="default: 15", step=5, maximum=20, minimum=10)
|
| 135 |
+
guidance_scale = gr.Slider(label="Guidance scale", value=3.5, info="default: 3.5", step=0.5, maximum=6.5, minimum=2.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
submit = gr.Button("Animate")
|
| 137 |
+
motion_sequence.upload(lambda x: x, motion_sequence, motion_sequence, queue=False)
|
| 138 |
+
reference_image.upload(lambda x: Image.fromarray(x), reference_image, reference_image, queue=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
submit.click(
|
| 140 |
controller.animate,
|
| 141 |
+
[reference_image, motion_sequence, width_slider, height_slider, length_slider, sampling_steps, guidance_scale, seed_textbox],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
animation,
|
| 143 |
)
|
|
|
|
|
|
|
| 144 |
gr.Markdown("## Examples")
|
| 145 |
gr.Examples(
|
| 146 |
examples=[
|
| 147 |
+
["./configs/inference/ref_images/anyone-5.png", "./configs/inference/pose_videos/anyone-video-2_kps.mp4", 512, 768, 72],
|
| 148 |
+
["./configs/inference/ref_images/anyone-10.png", "./configs/inference/pose_videos/anyone-video-1_kps.mp4", 512, 768, 72],
|
| 149 |
+
["./configs/inference/ref_images/anyone-2.png", "./configs/inference/pose_videos/anyone-video-5_kps.mp4", 512, 768, 72],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
],
|
| 151 |
inputs=[reference_image, motion_sequence, width_slider, height_slider, length_slider],
|
| 152 |
outputs=animation,
|
| 153 |
)
|
|
|
|
| 154 |
return demo
|
| 155 |
|
|
|
|
| 156 |
demo = ui()
|
| 157 |
demo.queue(max_size=10)
|
| 158 |
demo.launch(share=True, show_api=False)
|