Spaces:
Runtime error
Runtime error
Take resolution into account
Browse files
app.py
CHANGED
|
@@ -120,8 +120,8 @@ outputs_folder = './outputs/'
|
|
| 120 |
os.makedirs(outputs_folder, exist_ok=True)
|
| 121 |
|
| 122 |
input_image_debug_value = [None]
|
| 123 |
-
end_image_debug_value = [None]
|
| 124 |
input_video_debug_value = [None]
|
|
|
|
| 125 |
prompt_debug_value = [None]
|
| 126 |
total_second_length_debug_value = [None]
|
| 127 |
|
|
@@ -586,7 +586,7 @@ def worker(input_image, end_image, image_position, prompts, n_prompt, seed, reso
|
|
| 586 |
return
|
| 587 |
|
| 588 |
@torch.no_grad()
|
| 589 |
-
def worker_start_end(input_image, end_image, image_position, prompts, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, enable_preview, use_teacache, mp4_crf, fps_number):
|
| 590 |
def encode_prompt(prompt, n_prompt):
|
| 591 |
llama_vec, clip_l_pooler = encode_prompt_conds(prompt, text_encoder, text_encoder_2, tokenizer, tokenizer_2)
|
| 592 |
|
|
@@ -642,7 +642,7 @@ def worker_start_end(input_image, end_image, image_position, prompts, n_prompt,
|
|
| 642 |
stream.output_queue.push(('progress', (None, '', make_progress_bar_html(0, 'Processing start frame ...'))))
|
| 643 |
|
| 644 |
H, W, C = input_image.shape
|
| 645 |
-
height, width = find_nearest_bucket(H, W, resolution=
|
| 646 |
input_image_np = resize_and_center_crop(input_image, target_width=width, target_height=height)
|
| 647 |
|
| 648 |
Image.fromarray(input_image_np).save(os.path.join(outputs_folder, f'{job_id}_start.png'))
|
|
@@ -1144,7 +1144,7 @@ def process_on_gpu(input_image, end_image, image_position, prompts, generation_m
|
|
| 1144 |
global stream
|
| 1145 |
stream = AsyncStream()
|
| 1146 |
|
| 1147 |
-
async_run(worker, input_image, end_image, image_position, prompts, n_prompt, seed, resolution, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, enable_preview, use_teacache, mp4_crf, fps_number)
|
| 1148 |
|
| 1149 |
output_filename = None
|
| 1150 |
|
|
@@ -1186,12 +1186,12 @@ def process(input_image,
|
|
| 1186 |
resolution=640,
|
| 1187 |
total_second_length=5,
|
| 1188 |
latent_window_size=9,
|
| 1189 |
-
steps=
|
| 1190 |
cfg=1.0,
|
| 1191 |
gs=10.0,
|
| 1192 |
rs=0.0,
|
| 1193 |
gpu_memory_preservation=6,
|
| 1194 |
-
enable_preview=
|
| 1195 |
use_teacache=False,
|
| 1196 |
mp4_crf=16,
|
| 1197 |
fps_number=30
|
|
@@ -1226,7 +1226,7 @@ def process(input_image,
|
|
| 1226 |
yield gr.update(label="Previewed Frames"), None, '', '', gr.update(interactive=False), gr.update(interactive=True), gr.skip()
|
| 1227 |
|
| 1228 |
yield from process_on_gpu(input_image,
|
| 1229 |
-
|
| 1230 |
image_position,
|
| 1231 |
prompts,
|
| 1232 |
generation_mode,
|
|
@@ -1297,7 +1297,7 @@ def process_video(input_video, prompt, n_prompt, randomize_seed, seed, auto_allo
|
|
| 1297 |
prompt = prompt_debug_value[0]
|
| 1298 |
total_second_length = total_second_length_debug_value[0]
|
| 1299 |
allocation_time = min(total_second_length_debug_value[0] * 60 * 100, 600)
|
| 1300 |
-
input_video_debug_value[0] = prompt_debug_value[0] = total_second_length_debug_value[0] = None
|
| 1301 |
|
| 1302 |
if torch.cuda.device_count() == 0:
|
| 1303 |
gr.Warning('Set this space to GPU config to make it work.')
|
|
@@ -1400,8 +1400,8 @@ with block:
|
|
| 1400 |
generation_mode = gr.Radio([["Text-to-Video", "text"], ["Image-to-Video", "image"], ["Start & end frames", "start_end"], ["Video Extension", "video"]], elem_id="generation-mode", label="Generation mode", value = "image")
|
| 1401 |
text_to_video_hint = gr.HTML("Text-to-Video badly works with a flash effect at the start. I discourage to use the Text-to-Video feature. You should rather generate an image with Flux and use Image-to-Video. You will save time.")
|
| 1402 |
input_image = gr.Image(sources='upload', type="numpy", label="Image", height=320)
|
| 1403 |
-
image_position = gr.Slider(label="Image position", minimum=0, maximum=100, value=0, step=1, info='0=Video start; 100=Video end (lower quality)')
|
| 1404 |
end_image = gr.Image(sources='upload', type="numpy", label="End Frame (Optional)", height=320)
|
|
|
|
| 1405 |
input_video = gr.Video(sources='upload', label="Input Video", height=320)
|
| 1406 |
timeless_prompt = gr.Textbox(label="Timeless prompt", info='Used on the whole duration of the generation', value='', placeholder="The creature starts to move, fast motion, fixed camera, focus motion, consistent arm, consistent position, mute colors, insanely detailed")
|
| 1407 |
prompt_number = gr.Slider(label="Timed prompt number", minimum=0, maximum=1000, value=0, step=1, info='Prompts will automatically appear')
|
|
@@ -1426,7 +1426,7 @@ with block:
|
|
| 1426 |
enable_preview = gr.Checkbox(label='Enable preview', value=True, info='Display a preview around each second generated but it costs 2 sec. for each second generated.')
|
| 1427 |
use_teacache = gr.Checkbox(label='Use TeaCache', value=False, info='Faster speed and no break in brightness, but often makes hands and fingers slightly worse.')
|
| 1428 |
|
| 1429 |
-
n_prompt = gr.Textbox(label="Negative Prompt", value="Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, blurred, blurry, over-smooth", info='Requires using normal CFG (undistilled) instead of Distilled (set Distilled=1 and CFG > 1).')
|
| 1430 |
|
| 1431 |
fps_number = gr.Slider(label="Frame per seconds", info="The model is trained for 30 fps so other fps may generate weird results", minimum=10, maximum=60, value=30, step=1)
|
| 1432 |
|
|
@@ -1488,7 +1488,6 @@ with block:
|
|
| 1488 |
progress_desc = gr.Markdown('', elem_classes='no-generating-animation')
|
| 1489 |
progress_bar = gr.HTML('', elem_classes='no-generating-animation')
|
| 1490 |
|
| 1491 |
-
# 20250506 pftq: Updated inputs to include num_clean_frames
|
| 1492 |
ips = [input_image, end_image, image_position, final_prompt, generation_mode, n_prompt, randomize_seed, seed, auto_allocation, allocation_time, resolution, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, enable_preview, use_teacache, mp4_crf, fps_number]
|
| 1493 |
ips_video = [input_video, final_prompt, n_prompt, randomize_seed, seed, auto_allocation, allocation_time, batch, resolution, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, enable_preview, use_teacache, no_resize, mp4_crf, num_clean_frames, vae_batch]
|
| 1494 |
|
|
@@ -1502,7 +1501,7 @@ with block:
|
|
| 1502 |
0, # image_position
|
| 1503 |
"Overcrowed street in Japan, photorealistic, realistic, intricate details, 8k, insanely detailed",
|
| 1504 |
"text", # generation_mode
|
| 1505 |
-
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, blurred, blurry, over-smooth", # n_prompt
|
| 1506 |
True, # randomize_seed
|
| 1507 |
42, # seed
|
| 1508 |
True, # auto_allocation
|
|
@@ -1538,7 +1537,7 @@ with block:
|
|
| 1538 |
0, # image_position
|
| 1539 |
"A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The man talks and the woman listens; A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The woman talks, the man stops talking and the man listens; A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The woman talks and the man listens",
|
| 1540 |
"image", # generation_mode
|
| 1541 |
-
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, blurred, blurry, over-smooth", # n_prompt
|
| 1542 |
True, # randomize_seed
|
| 1543 |
42, # seed
|
| 1544 |
True, # auto_allocation
|
|
@@ -1562,7 +1561,7 @@ with block:
|
|
| 1562 |
0, # image_position
|
| 1563 |
"A dolphin emerges from the water, photorealistic, realistic, intricate details, 8k, insanely detailed",
|
| 1564 |
"image", # generation_mode
|
| 1565 |
-
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, blurred, blurry, over-smooth", # n_prompt
|
| 1566 |
True, # randomize_seed
|
| 1567 |
42, # seed
|
| 1568 |
True, # auto_allocation
|
|
@@ -1586,7 +1585,7 @@ with block:
|
|
| 1586 |
1, # image_position
|
| 1587 |
"A building starting to explode, photorealistic, realisitc, 8k, insanely detailed",
|
| 1588 |
"image", # generation_mode
|
| 1589 |
-
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, blurred, blurry, over-smooth", # n_prompt
|
| 1590 |
True, # randomize_seed
|
| 1591 |
42, # seed
|
| 1592 |
True, # auto_allocation
|
|
@@ -1610,7 +1609,7 @@ with block:
|
|
| 1610 |
50, # image_position
|
| 1611 |
"A building starting to explode, photorealistic, realisitc, 8k, insanely detailed",
|
| 1612 |
"image", # generation_mode
|
| 1613 |
-
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, blurred, blurry, over-smooth", # n_prompt
|
| 1614 |
True, # randomize_seed
|
| 1615 |
42, # seed
|
| 1616 |
True, # auto_allocation
|
|
@@ -1634,7 +1633,43 @@ with block:
|
|
| 1634 |
100, # image_position
|
| 1635 |
"A building starting to explode, photorealistic, realisitc, 8k, insanely detailed",
|
| 1636 |
"image", # generation_mode
|
| 1637 |
-
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, blurred, blurry, over-smooth", # n_prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1638 |
True, # randomize_seed
|
| 1639 |
42, # seed
|
| 1640 |
True, # auto_allocation
|
|
@@ -1667,7 +1702,7 @@ with block:
|
|
| 1667 |
[
|
| 1668 |
"./img_examples/Example1.mp4", # input_video
|
| 1669 |
"View of the sea as far as the eye can see, from the seaside, a piece of land is barely visible on the horizon at the middle, the sky is radiant, reflections of the sun in the water, photorealistic, realistic, intricate details, 8k, insanely detailed",
|
| 1670 |
-
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, blurred, blurry, over-smooth", # n_prompt
|
| 1671 |
True, # randomize_seed
|
| 1672 |
42, # seed
|
| 1673 |
True, # auto_allocation
|
|
@@ -1691,7 +1726,7 @@ with block:
|
|
| 1691 |
[
|
| 1692 |
"./img_examples/Example1.mp4", # input_video
|
| 1693 |
"View of the sea as far as the eye can see, from the seaside, a piece of land is barely visible on the horizon at the middle, the sky is radiant, reflections of the sun in the water, photorealistic, realistic, intricate details, 8k, insanely detailed",
|
| 1694 |
-
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, blurred, blurry, over-smooth", # n_prompt
|
| 1695 |
True, # randomize_seed
|
| 1696 |
42, # seed
|
| 1697 |
True, # auto_allocation
|
|
@@ -1729,7 +1764,7 @@ with block:
|
|
| 1729 |
0, # image_position
|
| 1730 |
"Overcrowed street in Japan, photorealistic, realistic, intricate details, 8k, insanely detailed",
|
| 1731 |
"text", # generation_mode
|
| 1732 |
-
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, blurred, blurry, over-smooth", # n_prompt
|
| 1733 |
True, # randomize_seed
|
| 1734 |
42, # seed
|
| 1735 |
True, # auto_allocation
|
|
@@ -1764,7 +1799,7 @@ with block:
|
|
| 1764 |
0, # image_position
|
| 1765 |
"A dolphin emerges from the water, photorealistic, realistic, intricate details, 8k, insanely detailed",
|
| 1766 |
"image", # generation_mode
|
| 1767 |
-
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, blurred, blurry, over-smooth", # n_prompt
|
| 1768 |
True, # randomize_seed
|
| 1769 |
42, # seed
|
| 1770 |
True, # auto_allocation
|
|
@@ -1788,7 +1823,7 @@ with block:
|
|
| 1788 |
0, # image_position
|
| 1789 |
"A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The man talks and the woman listens; A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The woman talks, the man stops talking and the man listens; A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The woman talks and the man listens",
|
| 1790 |
"image", # generation_mode
|
| 1791 |
-
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, blurred, blurry, over-smooth", # n_prompt
|
| 1792 |
True, # randomize_seed
|
| 1793 |
42, # seed
|
| 1794 |
True, # auto_allocation
|
|
@@ -1812,7 +1847,7 @@ with block:
|
|
| 1812 |
0, # image_position
|
| 1813 |
"A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The woman talks and the man listens; A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The man talks, the woman stops talking and the woman listens A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The man talks and the woman listens",
|
| 1814 |
"image", # generation_mode
|
| 1815 |
-
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, blurred, blurry, over-smooth", # n_prompt
|
| 1816 |
True, # randomize_seed
|
| 1817 |
42, # seed
|
| 1818 |
True, # auto_allocation
|
|
@@ -1836,7 +1871,7 @@ with block:
|
|
| 1836 |
0, # image_position
|
| 1837 |
"A boy is walking to the right, full view, full-length view, cartoon",
|
| 1838 |
"image", # generation_mode
|
| 1839 |
-
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, blurred, blurry, over-smooth", # n_prompt
|
| 1840 |
True, # randomize_seed
|
| 1841 |
42, # seed
|
| 1842 |
True, # auto_allocation
|
|
@@ -1860,7 +1895,7 @@ with block:
|
|
| 1860 |
100, # image_position
|
| 1861 |
"A building starting to explode, photorealistic, realisitc, 8k, insanely detailed",
|
| 1862 |
"image", # generation_mode
|
| 1863 |
-
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, blurred, blurry, over-smooth", # n_prompt
|
| 1864 |
True, # randomize_seed
|
| 1865 |
42, # seed
|
| 1866 |
True, # auto_allocation
|
|
@@ -1886,13 +1921,48 @@ with block:
|
|
| 1886 |
cache_examples = False,
|
| 1887 |
)
|
| 1888 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1889 |
gr.Examples(
|
| 1890 |
label = "🎥 Examples from video",
|
| 1891 |
examples = [
|
| 1892 |
[
|
| 1893 |
"./img_examples/Example1.mp4", # input_video
|
| 1894 |
"View of the sea as far as the eye can see, from the seaside, a piece of land is barely visible on the horizon at the middle, the sky is radiant, reflections of the sun in the water, photorealistic, realistic, intricate details, 8k, insanely detailed",
|
| 1895 |
-
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, blurred, blurry, over-smooth", # n_prompt
|
| 1896 |
True, # randomize_seed
|
| 1897 |
42, # seed
|
| 1898 |
True, # auto_allocation
|
|
|
|
| 120 |
os.makedirs(outputs_folder, exist_ok=True)
|
| 121 |
|
| 122 |
input_image_debug_value = [None]
|
|
|
|
| 123 |
input_video_debug_value = [None]
|
| 124 |
+
end_image_debug_value = [None]
|
| 125 |
prompt_debug_value = [None]
|
| 126 |
total_second_length_debug_value = [None]
|
| 127 |
|
|
|
|
| 586 |
return
|
| 587 |
|
| 588 |
@torch.no_grad()
|
| 589 |
+
def worker_start_end(input_image, end_image, image_position, prompts, n_prompt, seed, resolution, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, enable_preview, use_teacache, mp4_crf, fps_number):
|
| 590 |
def encode_prompt(prompt, n_prompt):
|
| 591 |
llama_vec, clip_l_pooler = encode_prompt_conds(prompt, text_encoder, text_encoder_2, tokenizer, tokenizer_2)
|
| 592 |
|
|
|
|
| 642 |
stream.output_queue.push(('progress', (None, '', make_progress_bar_html(0, 'Processing start frame ...'))))
|
| 643 |
|
| 644 |
H, W, C = input_image.shape
|
| 645 |
+
height, width = find_nearest_bucket(H, W, resolution=resolution)
|
| 646 |
input_image_np = resize_and_center_crop(input_image, target_width=width, target_height=height)
|
| 647 |
|
| 648 |
Image.fromarray(input_image_np).save(os.path.join(outputs_folder, f'{job_id}_start.png'))
|
|
|
|
| 1144 |
global stream
|
| 1145 |
stream = AsyncStream()
|
| 1146 |
|
| 1147 |
+
async_run(worker_start_end if generation_mode == "start_end" else worker, input_image, end_image, image_position, prompts, n_prompt, seed, resolution, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, enable_preview, use_teacache, mp4_crf, fps_number)
|
| 1148 |
|
| 1149 |
output_filename = None
|
| 1150 |
|
|
|
|
| 1186 |
resolution=640,
|
| 1187 |
total_second_length=5,
|
| 1188 |
latent_window_size=9,
|
| 1189 |
+
steps=30,
|
| 1190 |
cfg=1.0,
|
| 1191 |
gs=10.0,
|
| 1192 |
rs=0.0,
|
| 1193 |
gpu_memory_preservation=6,
|
| 1194 |
+
enable_preview=False,
|
| 1195 |
use_teacache=False,
|
| 1196 |
mp4_crf=16,
|
| 1197 |
fps_number=30
|
|
|
|
| 1226 |
yield gr.update(label="Previewed Frames"), None, '', '', gr.update(interactive=False), gr.update(interactive=True), gr.skip()
|
| 1227 |
|
| 1228 |
yield from process_on_gpu(input_image,
|
| 1229 |
+
end_image,
|
| 1230 |
image_position,
|
| 1231 |
prompts,
|
| 1232 |
generation_mode,
|
|
|
|
| 1297 |
prompt = prompt_debug_value[0]
|
| 1298 |
total_second_length = total_second_length_debug_value[0]
|
| 1299 |
allocation_time = min(total_second_length_debug_value[0] * 60 * 100, 600)
|
| 1300 |
+
input_image_debug_value[0] = end_image_debug_value[0] = input_video_debug_value[0] = prompt_debug_value[0] = total_second_length_debug_value[0] = None
|
| 1301 |
|
| 1302 |
if torch.cuda.device_count() == 0:
|
| 1303 |
gr.Warning('Set this space to GPU config to make it work.')
|
|
|
|
| 1400 |
generation_mode = gr.Radio([["Text-to-Video", "text"], ["Image-to-Video", "image"], ["Start & end frames", "start_end"], ["Video Extension", "video"]], elem_id="generation-mode", label="Generation mode", value = "image")
|
| 1401 |
text_to_video_hint = gr.HTML("Text-to-Video badly works with a flash effect at the start. I discourage to use the Text-to-Video feature. You should rather generate an image with Flux and use Image-to-Video. You will save time.")
|
| 1402 |
input_image = gr.Image(sources='upload', type="numpy", label="Image", height=320)
|
|
|
|
| 1403 |
end_image = gr.Image(sources='upload', type="numpy", label="End Frame (Optional)", height=320)
|
| 1404 |
+
image_position = gr.Slider(label="Image position", minimum=0, maximum=100, value=0, step=1, info='0=Video start; 100=Video end (lower quality)')
|
| 1405 |
input_video = gr.Video(sources='upload', label="Input Video", height=320)
|
| 1406 |
timeless_prompt = gr.Textbox(label="Timeless prompt", info='Used on the whole duration of the generation', value='', placeholder="The creature starts to move, fast motion, fixed camera, focus motion, consistent arm, consistent position, mute colors, insanely detailed")
|
| 1407 |
prompt_number = gr.Slider(label="Timed prompt number", minimum=0, maximum=1000, value=0, step=1, info='Prompts will automatically appear')
|
|
|
|
| 1426 |
enable_preview = gr.Checkbox(label='Enable preview', value=True, info='Display a preview around each second generated but it costs 2 sec. for each second generated.')
|
| 1427 |
use_teacache = gr.Checkbox(label='Use TeaCache', value=False, info='Faster speed and no break in brightness, but often makes hands and fingers slightly worse.')
|
| 1428 |
|
| 1429 |
+
n_prompt = gr.Textbox(label="Negative Prompt", value="Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", info='Requires using normal CFG (undistilled) instead of Distilled (set Distilled=1 and CFG > 1).')
|
| 1430 |
|
| 1431 |
fps_number = gr.Slider(label="Frame per seconds", info="The model is trained for 30 fps so other fps may generate weird results", minimum=10, maximum=60, value=30, step=1)
|
| 1432 |
|
|
|
|
| 1488 |
progress_desc = gr.Markdown('', elem_classes='no-generating-animation')
|
| 1489 |
progress_bar = gr.HTML('', elem_classes='no-generating-animation')
|
| 1490 |
|
|
|
|
| 1491 |
ips = [input_image, end_image, image_position, final_prompt, generation_mode, n_prompt, randomize_seed, seed, auto_allocation, allocation_time, resolution, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, enable_preview, use_teacache, mp4_crf, fps_number]
|
| 1492 |
ips_video = [input_video, final_prompt, n_prompt, randomize_seed, seed, auto_allocation, allocation_time, batch, resolution, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, enable_preview, use_teacache, no_resize, mp4_crf, num_clean_frames, vae_batch]
|
| 1493 |
|
|
|
|
| 1501 |
0, # image_position
|
| 1502 |
"Overcrowed street in Japan, photorealistic, realistic, intricate details, 8k, insanely detailed",
|
| 1503 |
"text", # generation_mode
|
| 1504 |
+
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", # n_prompt
|
| 1505 |
True, # randomize_seed
|
| 1506 |
42, # seed
|
| 1507 |
True, # auto_allocation
|
|
|
|
| 1537 |
0, # image_position
|
| 1538 |
"A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The man talks and the woman listens; A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The woman talks, the man stops talking and the man listens; A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The woman talks and the man listens",
|
| 1539 |
"image", # generation_mode
|
| 1540 |
+
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", # n_prompt
|
| 1541 |
True, # randomize_seed
|
| 1542 |
42, # seed
|
| 1543 |
True, # auto_allocation
|
|
|
|
| 1561 |
0, # image_position
|
| 1562 |
"A dolphin emerges from the water, photorealistic, realistic, intricate details, 8k, insanely detailed",
|
| 1563 |
"image", # generation_mode
|
| 1564 |
+
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", # n_prompt
|
| 1565 |
True, # randomize_seed
|
| 1566 |
42, # seed
|
| 1567 |
True, # auto_allocation
|
|
|
|
| 1585 |
1, # image_position
|
| 1586 |
"A building starting to explode, photorealistic, realisitc, 8k, insanely detailed",
|
| 1587 |
"image", # generation_mode
|
| 1588 |
+
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", # n_prompt
|
| 1589 |
True, # randomize_seed
|
| 1590 |
42, # seed
|
| 1591 |
True, # auto_allocation
|
|
|
|
| 1609 |
50, # image_position
|
| 1610 |
"A building starting to explode, photorealistic, realisitc, 8k, insanely detailed",
|
| 1611 |
"image", # generation_mode
|
| 1612 |
+
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", # n_prompt
|
| 1613 |
True, # randomize_seed
|
| 1614 |
42, # seed
|
| 1615 |
True, # auto_allocation
|
|
|
|
| 1633 |
100, # image_position
|
| 1634 |
"A building starting to explode, photorealistic, realisitc, 8k, insanely detailed",
|
| 1635 |
"image", # generation_mode
|
| 1636 |
+
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", # n_prompt
|
| 1637 |
+
True, # randomize_seed
|
| 1638 |
+
42, # seed
|
| 1639 |
+
True, # auto_allocation
|
| 1640 |
+
180, # allocation_time
|
| 1641 |
+
672, # resolution
|
| 1642 |
+
1, # total_second_length
|
| 1643 |
+
9, # latent_window_size
|
| 1644 |
+
30, # steps
|
| 1645 |
+
1.0, # cfg
|
| 1646 |
+
10.0, # gs
|
| 1647 |
+
0.0, # rs
|
| 1648 |
+
6, # gpu_memory_preservation
|
| 1649 |
+
False, # enable_preview
|
| 1650 |
+
False, # use_teacache
|
| 1651 |
+
16, # mp4_crf
|
| 1652 |
+
30 # fps_number
|
| 1653 |
+
],
|
| 1654 |
+
],
|
| 1655 |
+
run_on_click = True,
|
| 1656 |
+
fn = process,
|
| 1657 |
+
inputs = ips,
|
| 1658 |
+
outputs = [result_video, preview_image, progress_desc, progress_bar, start_button, end_button, warning],
|
| 1659 |
+
cache_examples = torch.cuda.device_count() > 0,
|
| 1660 |
+
)
|
| 1661 |
+
|
| 1662 |
+
with gr.Row(elem_id="start_end_examples", visible=False):
|
| 1663 |
+
gr.Examples(
|
| 1664 |
+
label = "Examples from start and end frames",
|
| 1665 |
+
examples = [
|
| 1666 |
+
[
|
| 1667 |
+
"./img_examples/Example2.webp", # input_image
|
| 1668 |
+
None, # end_image
|
| 1669 |
+
0, # image_position
|
| 1670 |
+
"A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The man talks and the woman listens; A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The woman talks, the man stops talking and the man listens; A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The woman talks and the man listens",
|
| 1671 |
+
"start_end", # generation_mode
|
| 1672 |
+
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", # n_prompt
|
| 1673 |
True, # randomize_seed
|
| 1674 |
42, # seed
|
| 1675 |
True, # auto_allocation
|
|
|
|
| 1702 |
[
|
| 1703 |
"./img_examples/Example1.mp4", # input_video
|
| 1704 |
"View of the sea as far as the eye can see, from the seaside, a piece of land is barely visible on the horizon at the middle, the sky is radiant, reflections of the sun in the water, photorealistic, realistic, intricate details, 8k, insanely detailed",
|
| 1705 |
+
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", # n_prompt
|
| 1706 |
True, # randomize_seed
|
| 1707 |
42, # seed
|
| 1708 |
True, # auto_allocation
|
|
|
|
| 1726 |
[
|
| 1727 |
"./img_examples/Example1.mp4", # input_video
|
| 1728 |
"View of the sea as far as the eye can see, from the seaside, a piece of land is barely visible on the horizon at the middle, the sky is radiant, reflections of the sun in the water, photorealistic, realistic, intricate details, 8k, insanely detailed",
|
| 1729 |
+
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", # n_prompt
|
| 1730 |
True, # randomize_seed
|
| 1731 |
42, # seed
|
| 1732 |
True, # auto_allocation
|
|
|
|
| 1764 |
0, # image_position
|
| 1765 |
"Overcrowed street in Japan, photorealistic, realistic, intricate details, 8k, insanely detailed",
|
| 1766 |
"text", # generation_mode
|
| 1767 |
+
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", # n_prompt
|
| 1768 |
True, # randomize_seed
|
| 1769 |
42, # seed
|
| 1770 |
True, # auto_allocation
|
|
|
|
| 1799 |
0, # image_position
|
| 1800 |
"A dolphin emerges from the water, photorealistic, realistic, intricate details, 8k, insanely detailed",
|
| 1801 |
"image", # generation_mode
|
| 1802 |
+
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", # n_prompt
|
| 1803 |
True, # randomize_seed
|
| 1804 |
42, # seed
|
| 1805 |
True, # auto_allocation
|
|
|
|
| 1823 |
0, # image_position
|
| 1824 |
"A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The man talks and the woman listens; A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The woman talks, the man stops talking and the man listens; A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The woman talks and the man listens",
|
| 1825 |
"image", # generation_mode
|
| 1826 |
+
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", # n_prompt
|
| 1827 |
True, # randomize_seed
|
| 1828 |
42, # seed
|
| 1829 |
True, # auto_allocation
|
|
|
|
| 1847 |
0, # image_position
|
| 1848 |
"A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The woman talks and the man listens; A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The man talks, the woman stops talking and the woman listens A man on the left and a woman on the right face each other ready to start a conversation, large space between the persons, full view, full-length view, 3D, pixar, 3D render, CGI. The man talks and the woman listens",
|
| 1849 |
"image", # generation_mode
|
| 1850 |
+
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", # n_prompt
|
| 1851 |
True, # randomize_seed
|
| 1852 |
42, # seed
|
| 1853 |
True, # auto_allocation
|
|
|
|
| 1871 |
0, # image_position
|
| 1872 |
"A boy is walking to the right, full view, full-length view, cartoon",
|
| 1873 |
"image", # generation_mode
|
| 1874 |
+
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", # n_prompt
|
| 1875 |
True, # randomize_seed
|
| 1876 |
42, # seed
|
| 1877 |
True, # auto_allocation
|
|
|
|
| 1895 |
100, # image_position
|
| 1896 |
"A building starting to explode, photorealistic, realisitc, 8k, insanely detailed",
|
| 1897 |
"image", # generation_mode
|
| 1898 |
+
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", # n_prompt
|
| 1899 |
True, # randomize_seed
|
| 1900 |
42, # seed
|
| 1901 |
True, # auto_allocation
|
|
|
|
| 1921 |
cache_examples = False,
|
| 1922 |
)
|
| 1923 |
|
| 1924 |
+
gr.Examples(
|
| 1925 |
+
label = "🖼️ Examples from start and end frames",
|
| 1926 |
+
examples = [
|
| 1927 |
+
[
|
| 1928 |
+
"./img_examples/Example1.png", # input_image
|
| 1929 |
+
None, # end_image
|
| 1930 |
+
0, # image_position
|
| 1931 |
+
"A dolphin emerges from the water, photorealistic, realistic, intricate details, 8k, insanely detailed",
|
| 1932 |
+
"start_end", # generation_mode
|
| 1933 |
+
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", # n_prompt
|
| 1934 |
+
True, # randomize_seed
|
| 1935 |
+
42, # seed
|
| 1936 |
+
True, # auto_allocation
|
| 1937 |
+
180, # allocation_time
|
| 1938 |
+
672, # resolution
|
| 1939 |
+
1, # total_second_length
|
| 1940 |
+
9, # latent_window_size
|
| 1941 |
+
30, # steps
|
| 1942 |
+
1.0, # cfg
|
| 1943 |
+
10.0, # gs
|
| 1944 |
+
0.0, # rs
|
| 1945 |
+
6, # gpu_memory_preservation
|
| 1946 |
+
False, # enable_preview
|
| 1947 |
+
True, # use_teacache
|
| 1948 |
+
16, # mp4_crf
|
| 1949 |
+
30 # fps_number
|
| 1950 |
+
],
|
| 1951 |
+
],
|
| 1952 |
+
run_on_click = True,
|
| 1953 |
+
fn = process,
|
| 1954 |
+
inputs = ips,
|
| 1955 |
+
outputs = [result_video, preview_image, progress_desc, progress_bar, start_button, end_button, warning],
|
| 1956 |
+
cache_examples = False,
|
| 1957 |
+
)
|
| 1958 |
+
|
| 1959 |
gr.Examples(
|
| 1960 |
label = "🎥 Examples from video",
|
| 1961 |
examples = [
|
| 1962 |
[
|
| 1963 |
"./img_examples/Example1.mp4", # input_video
|
| 1964 |
"View of the sea as far as the eye can see, from the seaside, a piece of land is barely visible on the horizon at the middle, the sky is radiant, reflections of the sun in the water, photorealistic, realistic, intricate details, 8k, insanely detailed",
|
| 1965 |
+
"Missing arm, long hand, unrealistic position, impossible contortion, visible bone, muscle contraction, poorly framed, blurred, blurry, over-smooth", # n_prompt
|
| 1966 |
True, # randomize_seed
|
| 1967 |
42, # seed
|
| 1968 |
True, # auto_allocation
|