Spaces:
Running
on
Zero
Running
on
Zero
add examples
Browse files
app.py
CHANGED
|
@@ -86,7 +86,16 @@ stream = AsyncStream()
|
|
| 86 |
outputs_folder = './outputs/'
|
| 87 |
os.makedirs(outputs_folder, exist_ok=True)
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
|
|
|
| 90 |
@torch.no_grad()
|
| 91 |
def worker(input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache, mp4_crf):
|
| 92 |
total_latent_sections = (total_second_length * 30) / (latent_window_size * 4)
|
|
@@ -288,7 +297,20 @@ def get_duration(input_image, prompt, t2v, n_prompt, seed, total_second_length,
|
|
| 288 |
return total_second_length * 60
|
| 289 |
|
| 290 |
@spaces.GPU(duration=get_duration)
|
| 291 |
-
def process(input_image, prompt,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 292 |
global stream
|
| 293 |
|
| 294 |
# assert input_image is not None, 'No input image!'
|
|
@@ -385,5 +407,13 @@ adapted from the officical code repo [FramePack](https://github.com/lllyasviel/F
|
|
| 385 |
start_button.click(fn=process, inputs=ips, outputs=[result_video, preview_image, progress_desc, progress_bar, start_button, end_button])
|
| 386 |
end_button.click(fn=end_process)
|
| 387 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
|
| 389 |
block.launch(share=True)
|
|
|
|
| 86 |
outputs_folder = './outputs/'
|
| 87 |
os.makedirs(outputs_folder, exist_ok=True)
|
| 88 |
|
| 89 |
+
examples = [
|
| 90 |
+
["img_examples/1.png", "The girl dances gracefully, with clear movements, full of charm.",],
|
| 91 |
+
["img_examples/2.jpg", "The man dances flamboyantly, swinging his hips and striking bold poses with dramatic flair."],
|
| 92 |
+
["img_examples/3.png", "The woman dances elegantly among the blossoms, spinning slowly with flowing sleeves and graceful hand movements."],
|
| 93 |
+
]
|
| 94 |
+
|
| 95 |
+
def generate_examples(input_image, prompt):
|
| 96 |
+
return process(input_image, prompt)
|
| 97 |
|
| 98 |
+
|
| 99 |
@torch.no_grad()
|
| 100 |
def worker(input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache, mp4_crf):
|
| 101 |
total_latent_sections = (total_second_length * 30) / (latent_window_size * 4)
|
|
|
|
| 297 |
return total_second_length * 60
|
| 298 |
|
| 299 |
@spaces.GPU(duration=get_duration)
|
| 300 |
+
def process(input_image, prompt,
|
| 301 |
+
t2v=False,
|
| 302 |
+
n_prompt="",
|
| 303 |
+
seed=31337,
|
| 304 |
+
total_second_length=5,
|
| 305 |
+
latent_window_size=9,
|
| 306 |
+
steps=25,
|
| 307 |
+
cfg=1.0,
|
| 308 |
+
gs=10.0,
|
| 309 |
+
rs=0.0,
|
| 310 |
+
gpu_memory_preservation=6,
|
| 311 |
+
use_teacache=True,
|
| 312 |
+
mp4_crf=16
|
| 313 |
+
):
|
| 314 |
global stream
|
| 315 |
|
| 316 |
# assert input_image is not None, 'No input image!'
|
|
|
|
| 407 |
start_button.click(fn=process, inputs=ips, outputs=[result_video, preview_image, progress_desc, progress_bar, start_button, end_button])
|
| 408 |
end_button.click(fn=end_process)
|
| 409 |
|
| 410 |
+
gr.Examples(
|
| 411 |
+
examples,
|
| 412 |
+
inputs=[input_image, prompt],
|
| 413 |
+
outputs=[result_video, preview_image, progress_desc, progress_bar, start_button, end_button],
|
| 414 |
+
fn=generate_examples,
|
| 415 |
+
cache_examples=True
|
| 416 |
+
)
|
| 417 |
+
|
| 418 |
|
| 419 |
block.launch(share=True)
|