Spaces:
Running
Running
update
Browse files- .gitattributes +8 -0
- app.py +137 -45
- examples/mix/1/1.jpeg +3 -0
- examples/mix/1/1.mp4 +3 -0
- examples/mix/2/2.jpeg +3 -0
- examples/mix/2/2.mp4 +3 -0
- examples/mov/1/1.jpeg +3 -0
- examples/mov/1/1.mp4 +3 -0
- examples/mov/2/.DS_Store +0 -0
- examples/mov/2/2.jpeg +3 -0
- examples/mov/2/2.mp4 +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,11 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
examples/mix/1/1.jpeg filter=lfs diff=lfs merge=lfs -text
|
37 |
+
examples/mix/1/1.mp4 filter=lfs diff=lfs merge=lfs -text
|
38 |
+
examples/mix/2/2.jpeg filter=lfs diff=lfs merge=lfs -text
|
39 |
+
examples/mix/2/2.mp4 filter=lfs diff=lfs merge=lfs -text
|
40 |
+
examples/mov/1/1.jpeg filter=lfs diff=lfs merge=lfs -text
|
41 |
+
examples/mov/1/1.mp4 filter=lfs diff=lfs merge=lfs -text
|
42 |
+
examples/mov/2/2.jpeg filter=lfs diff=lfs merge=lfs -text
|
43 |
+
examples/mov/2/2.mp4 filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
@@ -8,7 +8,6 @@ import time
|
|
8 |
import gradio as gr
|
9 |
import requests
|
10 |
|
11 |
-
os.system("pip install dashscope")
|
12 |
import dashscope
|
13 |
from dashscope.utils.oss_utils import check_and_upload_local
|
14 |
|
@@ -112,11 +111,121 @@ def start_app():
|
|
112 |
|
113 |
with gr.Blocks(title="Wan2.2-Animate 视频生成") as demo:
|
114 |
gr.HTML("""
|
115 |
-
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
</div>
|
|
|
118 |
""")
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
|
121 |
with gr.Row():
|
122 |
with gr.Column():
|
@@ -133,24 +242,23 @@ def start_app():
|
|
133 |
|
134 |
with gr.Row():
|
135 |
model_id = gr.Dropdown(
|
136 |
-
label="
|
137 |
choices=["wan2.2-animate-move", "wan2.2-animate-mix"],
|
138 |
value="wan2.2-animate-move",
|
139 |
-
info="
|
140 |
)
|
141 |
|
142 |
model = gr.Dropdown(
|
143 |
-
label="
|
144 |
choices=["wan-pro", "wan-std"],
|
145 |
value="wan-pro",
|
146 |
-
info="支持标准模型std和专业模式pro两个版本"
|
147 |
)
|
148 |
|
149 |
run_button = gr.Button("Generate Video(生成视频)")
|
150 |
|
151 |
with gr.Column():
|
152 |
output_video = gr.Video(label="Output Video(输出视频)")
|
153 |
-
output_status = gr.Textbox(label="Status")
|
154 |
|
155 |
run_button.click(
|
156 |
fn=app.predict,
|
@@ -163,42 +271,26 @@ def start_app():
|
|
163 |
outputs=[output_video, output_status],
|
164 |
)
|
165 |
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
# example_data.append([
|
187 |
-
# files["image"],
|
188 |
-
# files["audio"],
|
189 |
-
# "480P"
|
190 |
-
# ])
|
191 |
-
|
192 |
-
# if example_data:
|
193 |
-
# gr.Examples(
|
194 |
-
# examples=example_data,
|
195 |
-
# inputs=[ref_img, video, resolution],
|
196 |
-
# outputs=output_video,
|
197 |
-
# fn=app.predict,
|
198 |
-
# cache_examples=False,
|
199 |
-
# )
|
200 |
-
|
201 |
-
demo.launch()
|
202 |
|
203 |
|
204 |
if __name__ == "__main__":
|
|
|
8 |
import gradio as gr
|
9 |
import requests
|
10 |
|
|
|
11 |
import dashscope
|
12 |
from dashscope.utils.oss_utils import check_and_upload_local
|
13 |
|
|
|
111 |
|
112 |
with gr.Blocks(title="Wan2.2-Animate 视频生成") as demo:
|
113 |
gr.HTML("""
|
114 |
+
|
115 |
+
|
116 |
+
<div style="padding: 2rem; text-align: center; max-width: 1200px; margin: 0 auto; font-family: Arial, sans-serif;">
|
117 |
+
|
118 |
+
<h1 style="font-size: 2.5rem; font-weight: bold; margin-bottom: 0.5rem; color: #333;">
|
119 |
+
Wan2.2-Animate: Unified Character Animation and Replacement with Holistic Replication
|
120 |
+
</h1>
|
121 |
+
|
122 |
+
<h3 style="font-size: 2.5rem; font-weight: bold; margin-bottom: 0.5rem; color: #333;">
|
123 |
+
Wan2.2-Animate: 统一的角色动画和视频人物替换模型
|
124 |
+
</h3>
|
125 |
+
|
126 |
+
<div style="font-size: 1.25rem; margin-bottom: 1.5rem; color: #555;">
|
127 |
+
Tongyi Lab, Alibaba
|
128 |
+
</div>
|
129 |
+
|
130 |
+
<div style="display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; margin-bottom: 1rem;">
|
131 |
+
<!-- 第一行按钮 -->
|
132 |
+
<a href="https://arxiv.org/abs/2509.14055" target="_blank"
|
133 |
+
style="display: inline-flex; align-items: center; padding: 0.5rem 1rem; background-color: #f0f0f0; /* 浅灰色背景 */ color: #333; /* 深色文字 */ text-decoration: none; border-radius: 9999px; font-weight: 500; transition: background-color 0.3s;">
|
134 |
+
<span style="margin-right: 0.5rem;">📄</span> <!-- 使用文档图标 -->
|
135 |
+
<span>Paper</span>
|
136 |
+
</a>
|
137 |
+
|
138 |
+
<a href="https://github.com/Wan-Video/Wan2.2" target="_blank"
|
139 |
+
style="display: inline-flex; align-items: center; padding: 0.5rem 1rem; background-color: #f0f0f0; color: #333; text-decoration: none; border-radius: 9999px; font-weight: 500; transition: background-color 0.3s;">
|
140 |
+
<span style="margin-right: 0.5rem;">💻</span> <!-- 使用电脑图标 -->
|
141 |
+
<span>GitHub</span>
|
142 |
+
</a>
|
143 |
+
|
144 |
+
<a href="https://huggingface.co/Wan-AI/Wan2.2-Animate-14B" target="_blank"
|
145 |
+
style="display: inline-flex; align-items: center; padding: 0.5rem 1rem; background-color: #f0f0f0; color: #333; text-decoration: none; border-radius: 9999px; font-weight: 500; transition: background-color 0.3s;">
|
146 |
+
<span style="margin-right: 0.5rem;">🤗</span>
|
147 |
+
<span>HF Model</span>
|
148 |
+
</a>
|
149 |
+
|
150 |
+
<a href="https://www.modelscope.cn/models/Wan-AI/Wan2.2-Animate-14B" target="_blank"
|
151 |
+
style="display: inline-flex; align-items: center; padding: 0.5rem 1rem; background-color: #f0f0f0; color: #333; text-decoration: none; border-radius: 9999px; font-weight: 500; transition: background-color 0.3s;">
|
152 |
+
<span style="margin-right: 0.5rem;">🤖</span>
|
153 |
+
<span>MS Model</span>
|
154 |
+
</a>
|
155 |
+
</div>
|
156 |
+
|
157 |
+
<div style="display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem;">
|
158 |
+
<!-- 第二行按钮 -->
|
159 |
+
<a href="https://huggingface.co/spaces/Wan-AI/Wan2.2-Animate" target="_blank"
|
160 |
+
style="display: inline-flex; align-items: center; padding: 0.5rem 1rem; background-color: #f0f0f0; color: #333; text-decoration: none; border-radius: 9999px; font-weight: 500; transition: background-color 0.3s;">
|
161 |
+
<span style="margin-right: 0.5rem;">🤗</span>
|
162 |
+
<span>HF Space</span>
|
163 |
+
</a>
|
164 |
+
|
165 |
+
<a href="https://www.modelscope.cn/studios/Wan-AI/Wan2.2-Animate" target="_blank"
|
166 |
+
style="display: inline-flex; align-items: center; padding: 0.5rem 1rem; background-color: #f0f0f0; color: #333; text-decoration: none; border-radius: 9999px; font-weight: 500; transition: background-color 0.3s;">
|
167 |
+
<span style="margin-right: 0.5rem;">🤖</span>
|
168 |
+
<span>MS Studio</span>
|
169 |
+
</a>
|
170 |
+
</div>
|
171 |
+
|
172 |
</div>
|
173 |
+
|
174 |
""")
|
175 |
+
|
176 |
+
gr.HTML("""
|
177 |
+
<details>
|
178 |
+
<summary>‼️Usage (使用说明)</summary>
|
179 |
+
|
180 |
+
Wan-Animate supports two mode:
|
181 |
+
<ul>
|
182 |
+
<li>Move Mode: animate the character in input image with movements from the input video</li>
|
183 |
+
<li>Mix Mode: replace the character in input video with the character in input image</li>
|
184 |
+
</ul>
|
185 |
+
|
186 |
+
Wan-Animate 支持两种模式:
|
187 |
+
<ul>
|
188 |
+
<li>Move模式: 用输入视频中提取的动作,驱动输入图片中的角色</li>
|
189 |
+
<li>Mix模式: 用输入图片中的角色,替换输入视频中的角色</li>
|
190 |
+
</ul>
|
191 |
+
|
192 |
+
Currently, the following restrictions apply to inputs:
|
193 |
+
|
194 |
+
<ul> <li>Video file size: Less than 200MB</li>
|
195 |
+
<li>Video resolution: The shorter side must be greater than 200, and the longer side must be less than 2048</li>
|
196 |
+
<li>Video duration: 2s to 30s</li>
|
197 |
+
<li>Video aspect ratio: 1:3 to 3:1</li>
|
198 |
+
<li>Video formats: mp4, avi, mov</li>
|
199 |
+
<li>Image file size: Less than 5MB</li>
|
200 |
+
<li>Image resolution: The shorter side must be greater than 200, and the longer side must be less than 4096</li>
|
201 |
+
<li>Image formats: jpg, png, jpeg, webp, bmp</li> </ul>
|
202 |
+
|
203 |
+
|
204 |
+
当前,对于输入有以下的限制
|
205 |
+
|
206 |
+
<ul>
|
207 |
+
<li>视频文件大小: 小于 200MB</li>
|
208 |
+
<li>视频分辨率: 最小边大于 200, 最大边小于2048</li>
|
209 |
+
<li>视频时长: 2s ~ 30s </li>
|
210 |
+
<li>视频比例:1:3 ~ 3:1 </li>
|
211 |
+
<li>视频格式: mp4, avi, mov </li>
|
212 |
+
<li>图片文件大小: 小于5MB </li>
|
213 |
+
<li>图片分辨率:最小边大于200,最大边小于4096 </li>
|
214 |
+
<li>图片格式: jpg, png, jpeg, webp, bmp </li>
|
215 |
+
</ul>
|
216 |
+
|
217 |
+
<p> Currently, the inference quality has two variants. You can use our open-source code for more flexible configuration. </p>
|
218 |
+
|
219 |
+
<p>当前,推理质量有两个变种。 您可以使用我们的开源代码,来进行更灵活的设置。</p>
|
220 |
+
|
221 |
+
<ul>
|
222 |
+
<li> wan-pro: 25fps, 720p </li>
|
223 |
+
<li> wan-std: 15fps, 720p </li>
|
224 |
+
</ul>
|
225 |
+
|
226 |
+
|
227 |
+
</details>
|
228 |
+
""")
|
229 |
|
230 |
with gr.Row():
|
231 |
with gr.Column():
|
|
|
242 |
|
243 |
with gr.Row():
|
244 |
model_id = gr.Dropdown(
|
245 |
+
label="Mode(模式)",
|
246 |
choices=["wan2.2-animate-move", "wan2.2-animate-mix"],
|
247 |
value="wan2.2-animate-move",
|
248 |
+
info=""
|
249 |
)
|
250 |
|
251 |
model = gr.Dropdown(
|
252 |
+
label="推理质量(Inference Quality)",
|
253 |
choices=["wan-pro", "wan-std"],
|
254 |
value="wan-pro",
|
|
|
255 |
)
|
256 |
|
257 |
run_button = gr.Button("Generate Video(生成视频)")
|
258 |
|
259 |
with gr.Column():
|
260 |
output_video = gr.Video(label="Output Video(输出视频)")
|
261 |
+
output_status = gr.Textbox(label="Status(状态)")
|
262 |
|
263 |
run_button.click(
|
264 |
fn=app.predict,
|
|
|
271 |
outputs=[output_video, output_status],
|
272 |
)
|
273 |
|
274 |
+
example_data = [
|
275 |
+
['./examples/mov/1/1.jpeg', './examples/mov/1/1.mp4', 'wan2.2-animate-move', 'wan-pro'],
|
276 |
+
['./examples/mov/2/2.jpeg', './examples/mov/2/2.mp4', 'wan2.2-animate-move', 'wan-pro'],
|
277 |
+
['./examples/mix/1/1.jpeg', './examples/mix/1/1.mp4', 'wan2.2-animate-mix', 'wan-pro'],
|
278 |
+
['./examples/mix/2/2.jpeg', './examples/mix/2/2.mp4', 'wan2.2-animate-mix', 'wan-pro']
|
279 |
+
]
|
280 |
+
|
281 |
+
if example_data:
|
282 |
+
gr.Examples(
|
283 |
+
examples=example_data,
|
284 |
+
inputs=[ref_img, video, model_id, model],
|
285 |
+
outputs=output_video,
|
286 |
+
fn=app.predict,
|
287 |
+
cache_examples=False,
|
288 |
+
)
|
289 |
+
|
290 |
+
demo.launch(
|
291 |
+
server_name="0.0.0.0",
|
292 |
+
server_port=7860
|
293 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
|
295 |
|
296 |
if __name__ == "__main__":
|
examples/mix/1/1.jpeg
ADDED
![]() |
Git LFS Details
|
examples/mix/1/1.mp4
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:56a6d2e530e66e502f58d3983541c0194974b11662171079375e2649bfab3fe8
|
3 |
+
size 593964
|
examples/mix/2/2.jpeg
ADDED
![]() |
Git LFS Details
|
examples/mix/2/2.mp4
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:db6da60e5fcb0fda0bff151bfbdbb7085d5a86a78508743cce2a25709de86a19
|
3 |
+
size 754294
|
examples/mov/1/1.jpeg
ADDED
![]() |
Git LFS Details
|
examples/mov/1/1.mp4
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:80f3cfe3786a7f8a94844476448fb45e7e115216ddcdaad14b0b88223be597e7
|
3 |
+
size 903201
|
examples/mov/2/.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
examples/mov/2/2.jpeg
ADDED
![]() |
Git LFS Details
|
examples/mov/2/2.mp4
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9a3ce91220c6018489bac2a546f58321f1afd40967e879e6a76b11b7745a5860
|
3 |
+
size 524263
|