Spaces:
Sleeping
Sleeping
Update easyanimate/ui/ui.py
Browse files- easyanimate/ui/ui.py +96 -99
easyanimate/ui/ui.py
CHANGED
|
@@ -673,12 +673,12 @@ def ui(GPU_memory_mode, weight_dtype):
|
|
| 673 |
with gr.Column(variant="panel"):
|
| 674 |
gr.Markdown(
|
| 675 |
"""
|
| 676 |
-
### 1. EasyAnimate Model Type (
|
| 677 |
"""
|
| 678 |
)
|
| 679 |
with gr.Row():
|
| 680 |
model_type = gr.Dropdown(
|
| 681 |
-
label="The model type of EasyAnimate (
|
| 682 |
choices=["Inpaint", "Control"],
|
| 683 |
value="Inpaint",
|
| 684 |
interactive=True,
|
|
@@ -691,7 +691,7 @@ def ui(GPU_memory_mode, weight_dtype):
|
|
| 691 |
)
|
| 692 |
with gr.Row():
|
| 693 |
easyanimate_edition_dropdown = gr.Dropdown(
|
| 694 |
-
label="The config of EasyAnimate Edition
|
| 695 |
choices=["v1", "v2", "v3", "v4", "v5", "v5.1"],
|
| 696 |
value="v5.1",
|
| 697 |
interactive=True,
|
|
@@ -703,7 +703,7 @@ def ui(GPU_memory_mode, weight_dtype):
|
|
| 703 |
)
|
| 704 |
with gr.Row():
|
| 705 |
diffusion_transformer_dropdown = gr.Dropdown(
|
| 706 |
-
label="Pretrained Model Path (
|
| 707 |
choices=controller.diffusion_transformer_list,
|
| 708 |
value="none",
|
| 709 |
interactive=True,
|
|
@@ -722,7 +722,7 @@ def ui(GPU_memory_mode, weight_dtype):
|
|
| 722 |
|
| 723 |
with gr.Row():
|
| 724 |
motion_module_dropdown = gr.Dropdown(
|
| 725 |
-
label="Select motion module (
|
| 726 |
choices=controller.motion_module_list,
|
| 727 |
value="none",
|
| 728 |
interactive=True,
|
|
@@ -736,7 +736,7 @@ def ui(GPU_memory_mode, weight_dtype):
|
|
| 736 |
motion_module_refresh_button.click(fn=update_motion_module, inputs=[], outputs=[motion_module_dropdown])
|
| 737 |
|
| 738 |
base_model_dropdown = gr.Dropdown(
|
| 739 |
-
label="Select base Dreambooth model (
|
| 740 |
choices=controller.personalized_model_list,
|
| 741 |
value="none",
|
| 742 |
interactive=True,
|
|
@@ -749,7 +749,7 @@ def ui(GPU_memory_mode, weight_dtype):
|
|
| 749 |
interactive=True,
|
| 750 |
)
|
| 751 |
|
| 752 |
-
lora_alpha_slider = gr.Slider(label="LoRA alpha (
|
| 753 |
|
| 754 |
personalized_refresh_button = gr.Button(value="\U0001F503", elem_classes="toolbutton")
|
| 755 |
def update_personalized_model():
|
|
@@ -763,35 +763,35 @@ def ui(GPU_memory_mode, weight_dtype):
|
|
| 763 |
with gr.Column(variant="panel"):
|
| 764 |
gr.Markdown(
|
| 765 |
"""
|
| 766 |
-
### 3. Configs for Generation (
|
| 767 |
"""
|
| 768 |
)
|
| 769 |
|
| 770 |
-
prompt_textbox = gr.Textbox(label="Prompt (
|
| 771 |
gr.Markdown(
|
| 772 |
"""
|
| 773 |
Using longer neg prompt such as "Blurring, mutation, deformation, distortion, dark and solid, comics, text subtitles, line art." can increase stability. Adding words such as "quiet, solid" to the neg prompt can increase dynamism.
|
| 774 |
-
|
| 775 |
"""
|
| 776 |
)
|
| 777 |
-
negative_prompt_textbox = gr.Textbox(label="Negative prompt (
|
| 778 |
|
| 779 |
with gr.Row():
|
| 780 |
with gr.Column():
|
| 781 |
with gr.Row():
|
| 782 |
sampler_dropdown = gr.Dropdown(
|
| 783 |
-
label="Sampling method (
|
| 784 |
choices=list(flow_scheduler_dict.keys()), value=list(flow_scheduler_dict.keys())[0]
|
| 785 |
)
|
| 786 |
-
sample_step_slider = gr.Slider(label="Sampling steps (
|
| 787 |
|
| 788 |
resize_method = gr.Radio(
|
| 789 |
["Generate by", "Resize according to Reference"],
|
| 790 |
value="Generate by",
|
| 791 |
show_label=False,
|
| 792 |
)
|
| 793 |
-
width_slider = gr.Slider(label="Width (
|
| 794 |
-
height_slider = gr.Slider(label="Height (
|
| 795 |
base_resolution = gr.Radio(label="Base Resolution of Pretrained Models", value=512, choices=[512, 768, 960], visible=False)
|
| 796 |
|
| 797 |
with gr.Group():
|
|
@@ -801,18 +801,18 @@ def ui(GPU_memory_mode, weight_dtype):
|
|
| 801 |
show_label=False,
|
| 802 |
)
|
| 803 |
with gr.Row():
|
| 804 |
-
length_slider = gr.Slider(label="Animation length (
|
| 805 |
-
overlap_video_length = gr.Slider(label="Overlap length (
|
| 806 |
-
partial_video_length = gr.Slider(label="Partial video generation length (
|
| 807 |
|
| 808 |
source_method = gr.Radio(
|
| 809 |
-
["Text to Video (
|
| 810 |
-
value="Text to Video (
|
| 811 |
show_label=False,
|
| 812 |
)
|
| 813 |
with gr.Column(visible = False) as image_to_video_col:
|
| 814 |
start_image = gr.Image(
|
| 815 |
-
label="The image at the beginning of the video (
|
| 816 |
elem_id="i2v_start", sources="upload", type="filepath",
|
| 817 |
)
|
| 818 |
|
|
@@ -837,27 +837,27 @@ def ui(GPU_memory_mode, weight_dtype):
|
|
| 837 |
)
|
| 838 |
template_gallery.select(select_template, None, [start_image, prompt_textbox])
|
| 839 |
|
| 840 |
-
with gr.Accordion("The image at the ending of the video (
|
| 841 |
-
end_image = gr.Image(label="The image at the ending of the video (
|
| 842 |
|
| 843 |
with gr.Column(visible = False) as video_to_video_col:
|
| 844 |
with gr.Row():
|
| 845 |
validation_video = gr.Video(
|
| 846 |
-
label="The video to convert (
|
| 847 |
elem_id="v2v", sources="upload",
|
| 848 |
)
|
| 849 |
-
with gr.Accordion("The mask of the video to inpaint (
|
| 850 |
gr.Markdown(
|
| 851 |
"""
|
| 852 |
- Please set a larger denoise_strength when using validation_video_mask, such as 1.00 instead of 0.70
|
| 853 |
-
- (请设置更大的denoise_strength
|
| 854 |
"""
|
| 855 |
)
|
| 856 |
validation_video_mask = gr.Image(
|
| 857 |
-
label="The mask of the video to inpaint (
|
| 858 |
show_label=False, elem_id="v2v_mask", sources="upload", type="filepath"
|
| 859 |
)
|
| 860 |
-
denoise_strength = gr.Slider(label="Denoise strength (
|
| 861 |
|
| 862 |
with gr.Column(visible = False) as control_video_col:
|
| 863 |
gr.Markdown(
|
|
@@ -867,14 +867,14 @@ def ui(GPU_memory_mode, weight_dtype):
|
|
| 867 |
"""
|
| 868 |
)
|
| 869 |
control_video = gr.Video(
|
| 870 |
-
label="The control video (
|
| 871 |
elem_id="v2v_control", sources="upload",
|
| 872 |
)
|
| 873 |
|
| 874 |
-
cfg_scale_slider = gr.Slider(label="CFG Scale (
|
| 875 |
|
| 876 |
with gr.Row():
|
| 877 |
-
seed_textbox = gr.Textbox(label="Seed (
|
| 878 |
seed_button = gr.Button(value="\U0001F3B2", elem_classes="toolbutton")
|
| 879 |
seed_button.click(
|
| 880 |
fn=lambda: gr.Textbox(value=random.randint(1, 1e8)) if gradio_version_is_above_4 else gr.Textbox.update(value=random.randint(1, 1e8)),
|
|
@@ -882,11 +882,11 @@ def ui(GPU_memory_mode, weight_dtype):
|
|
| 882 |
outputs=[seed_textbox]
|
| 883 |
)
|
| 884 |
|
| 885 |
-
generate_button = gr.Button(value="Generate (
|
| 886 |
|
| 887 |
with gr.Column():
|
| 888 |
-
result_image = gr.Image(label="Generated Image (
|
| 889 |
-
result_video = gr.Video(label="Generated Animation (
|
| 890 |
infer_progress = gr.Textbox(
|
| 891 |
label="Generation Info (生成信息)",
|
| 892 |
value="No task currently",
|
|
@@ -921,11 +921,11 @@ def ui(GPU_memory_mode, weight_dtype):
|
|
| 921 |
)
|
| 922 |
|
| 923 |
def upload_source_method(source_method):
|
| 924 |
-
if source_method == "Text to Video (
|
| 925 |
return [gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update(value=None)]
|
| 926 |
-
elif source_method == "Image to Video (
|
| 927 |
return [gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(), gr.update(), gr.update(value=None), gr.update(value=None), gr.update(value=None)]
|
| 928 |
-
elif source_method == "Video to Video (
|
| 929 |
return [gr.update(visible=False), gr.update(visible=True), gr.update(visible=False), gr.update(value=None), gr.update(value=None), gr.update(), gr.update(), gr.update(value=None)]
|
| 930 |
else:
|
| 931 |
return [gr.update(visible=False), gr.update(visible=False), gr.update(visible=True), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update()]
|
|
@@ -1385,26 +1385,26 @@ def ui_modelscope(model_type, edition, config_path, model_name, savedir_sample,
|
|
| 1385 |
with gr.Column(variant="panel"):
|
| 1386 |
gr.Markdown(
|
| 1387 |
"""
|
| 1388 |
-
### 1. Model checkpoints (
|
| 1389 |
"""
|
| 1390 |
)
|
| 1391 |
with gr.Row():
|
| 1392 |
diffusion_transformer_dropdown = gr.Dropdown(
|
| 1393 |
-
label="Pretrained Model Path (
|
| 1394 |
choices=[model_name],
|
| 1395 |
value=model_name,
|
| 1396 |
interactive=False,
|
| 1397 |
)
|
| 1398 |
with gr.Row():
|
| 1399 |
motion_module_dropdown = gr.Dropdown(
|
| 1400 |
-
label="Select motion module (
|
| 1401 |
choices=["none"],
|
| 1402 |
value="none",
|
| 1403 |
interactive=False,
|
| 1404 |
visible=False
|
| 1405 |
)
|
| 1406 |
base_model_dropdown = gr.Dropdown(
|
| 1407 |
-
label="Select base Dreambooth model (
|
| 1408 |
choices=["none"],
|
| 1409 |
value="none",
|
| 1410 |
interactive=False,
|
|
@@ -1424,42 +1424,41 @@ def ui_modelscope(model_type, edition, config_path, model_name, savedir_sample,
|
|
| 1424 |
interactive=False,
|
| 1425 |
)
|
| 1426 |
|
| 1427 |
-
lora_alpha_slider = gr.Slider(label="LoRA alpha (
|
| 1428 |
|
| 1429 |
with gr.Column(variant="panel"):
|
| 1430 |
gr.Markdown(
|
| 1431 |
"""
|
| 1432 |
-
### 2. Configs for Generation (
|
| 1433 |
"""
|
| 1434 |
)
|
| 1435 |
|
| 1436 |
-
prompt_textbox = gr.Textbox(label="Prompt (
|
| 1437 |
gr.Markdown(
|
| 1438 |
"""
|
| 1439 |
Using longer neg prompt such as "Blurring, mutation, deformation, distortion, dark and solid, comics, text subtitles, line art." can increase stability. Adding words such as "quiet, solid" to the neg prompt can increase dynamism.
|
| 1440 |
-
使用更长的neg prompt如"模糊,突变,变形,失真,画面暗,文本字幕,画面固定,连环画,漫画,线稿,没有主体。",可以增加稳定性。在neg prompt中添加"安静,固定"等词语可以增加动态性。
|
| 1441 |
"""
|
| 1442 |
)
|
| 1443 |
-
negative_prompt_textbox = gr.Textbox(label="Negative prompt (
|
| 1444 |
|
| 1445 |
with gr.Row():
|
| 1446 |
with gr.Column():
|
| 1447 |
with gr.Row():
|
| 1448 |
if edition in ["v5.1"]:
|
| 1449 |
sampler_dropdown = gr.Dropdown(
|
| 1450 |
-
label="Sampling method (
|
| 1451 |
choices=list(flow_scheduler_dict.keys()), value=list(flow_scheduler_dict.keys())[0]
|
| 1452 |
)
|
| 1453 |
else:
|
| 1454 |
sampler_dropdown = gr.Dropdown(
|
| 1455 |
-
label="Sampling method (
|
| 1456 |
choices=list(ddpm_scheduler_dict.keys()), value=list(ddpm_scheduler_dict.keys())[0]
|
| 1457 |
)
|
| 1458 |
-
sample_step_slider = gr.Slider(label="Sampling steps (
|
| 1459 |
|
| 1460 |
if edition == "v1":
|
| 1461 |
-
width_slider = gr.Slider(label="Width (
|
| 1462 |
-
height_slider = gr.Slider(label="Height (
|
| 1463 |
|
| 1464 |
with gr.Group():
|
| 1465 |
generation_method = gr.Radio(
|
|
@@ -1468,18 +1467,18 @@ def ui_modelscope(model_type, edition, config_path, model_name, savedir_sample,
|
|
| 1468 |
show_label=False,
|
| 1469 |
visible=False,
|
| 1470 |
)
|
| 1471 |
-
length_slider = gr.Slider(label="Animation length (
|
| 1472 |
-
overlap_video_length = gr.Slider(label="Overlap length (
|
| 1473 |
-
partial_video_length = gr.Slider(label="Partial video generation length (
|
| 1474 |
-
cfg_scale_slider = gr.Slider(label="CFG Scale (
|
| 1475 |
else:
|
| 1476 |
resize_method = gr.Radio(
|
| 1477 |
["Generate by", "Resize according to Reference"],
|
| 1478 |
value="Generate by",
|
| 1479 |
show_label=False,
|
| 1480 |
)
|
| 1481 |
-
width_slider = gr.Slider(label="Width (
|
| 1482 |
-
height_slider = gr.Slider(label="Height (
|
| 1483 |
base_resolution = gr.Radio(label="Base Resolution of Pretrained Models", value=512, choices=[512, 768, 960], interactive=False, visible=False)
|
| 1484 |
|
| 1485 |
with gr.Group():
|
|
@@ -1490,20 +1489,20 @@ def ui_modelscope(model_type, edition, config_path, model_name, savedir_sample,
|
|
| 1490 |
visible=True,
|
| 1491 |
)
|
| 1492 |
if edition in ["v2", "v3", "v4"]:
|
| 1493 |
-
length_slider = gr.Slider(label="Animation length (
|
| 1494 |
else:
|
| 1495 |
-
length_slider = gr.Slider(label="Animation length (
|
| 1496 |
-
overlap_video_length = gr.Slider(label="Overlap length (
|
| 1497 |
-
partial_video_length = gr.Slider(label="Partial video generation length (
|
| 1498 |
|
| 1499 |
source_method = gr.Radio(
|
| 1500 |
-
["Text to Video (
|
| 1501 |
-
value="Text to Video (
|
| 1502 |
show_label=False,
|
| 1503 |
)
|
| 1504 |
with gr.Column(visible = False) as image_to_video_col:
|
| 1505 |
with gr.Row():
|
| 1506 |
-
start_image = gr.Image(label="The image at the beginning of the video (
|
| 1507 |
|
| 1508 |
template_gallery_path = ["asset/1.png", "asset/2.png", "asset/3.png", "asset/4.png", "asset/5.png"]
|
| 1509 |
def select_template(evt: gr.SelectData):
|
|
@@ -1526,27 +1525,27 @@ def ui_modelscope(model_type, edition, config_path, model_name, savedir_sample,
|
|
| 1526 |
)
|
| 1527 |
template_gallery.select(select_template, None, [start_image, prompt_textbox])
|
| 1528 |
|
| 1529 |
-
with gr.Accordion("The image at the ending of the video (
|
| 1530 |
-
end_image = gr.Image(label="The image at the ending of the video (
|
| 1531 |
|
| 1532 |
with gr.Column(visible = False) as video_to_video_col:
|
| 1533 |
with gr.Row():
|
| 1534 |
validation_video = gr.Video(
|
| 1535 |
-
label="The video to convert (
|
| 1536 |
elem_id="v2v", sources="upload",
|
| 1537 |
)
|
| 1538 |
-
with gr.Accordion("The mask of the video to inpaint (
|
| 1539 |
gr.Markdown(
|
| 1540 |
"""
|
| 1541 |
- Please set a larger denoise_strength when using validation_video_mask, such as 1.00 instead of 0.70
|
| 1542 |
-
- (
|
| 1543 |
"""
|
| 1544 |
)
|
| 1545 |
validation_video_mask = gr.Image(
|
| 1546 |
-
label="The mask of the video to inpaint (
|
| 1547 |
show_label=False, elem_id="v2v_mask", sources="upload", type="filepath"
|
| 1548 |
)
|
| 1549 |
-
denoise_strength = gr.Slider(label="Denoise strength (
|
| 1550 |
|
| 1551 |
with gr.Column(visible = False) as control_video_col:
|
| 1552 |
gr.Markdown(
|
|
@@ -1556,14 +1555,14 @@ def ui_modelscope(model_type, edition, config_path, model_name, savedir_sample,
|
|
| 1556 |
"""
|
| 1557 |
)
|
| 1558 |
control_video = gr.Video(
|
| 1559 |
-
label="The control video (
|
| 1560 |
elem_id="v2v_control", sources="upload",
|
| 1561 |
)
|
| 1562 |
|
| 1563 |
-
cfg_scale_slider = gr.Slider(label="CFG Scale (
|
| 1564 |
|
| 1565 |
with gr.Row():
|
| 1566 |
-
seed_textbox = gr.Textbox(label="Seed (
|
| 1567 |
seed_button = gr.Button(value="\U0001F3B2", elem_classes="toolbutton")
|
| 1568 |
seed_button.click(
|
| 1569 |
fn=lambda: gr.Textbox(value=random.randint(1, 1e8)) if gradio_version_is_above_4 else gr.Textbox.update(value=random.randint(1, 1e8)),
|
|
@@ -1571,13 +1570,13 @@ def ui_modelscope(model_type, edition, config_path, model_name, savedir_sample,
|
|
| 1571 |
outputs=[seed_textbox]
|
| 1572 |
)
|
| 1573 |
|
| 1574 |
-
generate_button = gr.Button(value="Generate (
|
| 1575 |
|
| 1576 |
with gr.Column():
|
| 1577 |
-
result_image = gr.Image(label="Generated Image (
|
| 1578 |
-
result_video = gr.Video(label="Generated Animation (
|
| 1579 |
infer_progress = gr.Textbox(
|
| 1580 |
-
label="Generation Info (
|
| 1581 |
value="No task currently",
|
| 1582 |
interactive=False
|
| 1583 |
)
|
|
@@ -1602,11 +1601,11 @@ def ui_modelscope(model_type, edition, config_path, model_name, savedir_sample,
|
|
| 1602 |
)
|
| 1603 |
|
| 1604 |
def upload_source_method(source_method):
|
| 1605 |
-
if source_method == "Text to Video
|
| 1606 |
return [gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update(value=None)]
|
| 1607 |
-
elif source_method == "Image to Video
|
| 1608 |
return [gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(), gr.update(), gr.update(value=None), gr.update(value=None), gr.update(value=None)]
|
| 1609 |
-
elif source_method == "Video to Video
|
| 1610 |
return [gr.update(visible=False), gr.update(visible=True), gr.update(visible=False), gr.update(value=None), gr.update(value=None), gr.update(), gr.update(), gr.update(value=None)]
|
| 1611 |
else:
|
| 1612 |
return [gr.update(visible=False), gr.update(visible=False), gr.update(visible=True), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update()]
|
|
@@ -1854,7 +1853,7 @@ def ui_eas(edition, config_path, model_name, savedir_sample):
|
|
| 1854 |
interactive=False,
|
| 1855 |
)
|
| 1856 |
|
| 1857 |
-
lora_alpha_slider = gr.Slider(label="LoRA alpha (
|
| 1858 |
|
| 1859 |
with gr.Column(variant="panel"):
|
| 1860 |
gr.Markdown(
|
|
@@ -1867,7 +1866,6 @@ def ui_eas(edition, config_path, model_name, savedir_sample):
|
|
| 1867 |
gr.Markdown(
|
| 1868 |
"""
|
| 1869 |
Using longer neg prompt such as "Blurring, mutation, deformation, distortion, dark and solid, comics, text subtitles, line art." can increase stability. Adding words such as "quiet, solid" to the neg prompt can increase dynamism.
|
| 1870 |
-
使用更长的neg prompt如"模糊,突变,变形,失真,画面暗,文本字幕,画面固定,连环画,漫画,线稿,没有主体。",可以增加稳定性。在neg prompt中添加"安静,固定"等词语可以增加动态性。
|
| 1871 |
"""
|
| 1872 |
)
|
| 1873 |
negative_prompt_textbox = gr.Textbox(label="Negative prompt", lines=2, value="Twisted body, limb deformities, text captions, comic, static, ugly, error, messy code." )
|
|
@@ -1877,12 +1875,12 @@ def ui_eas(edition, config_path, model_name, savedir_sample):
|
|
| 1877 |
with gr.Row():
|
| 1878 |
if edition in ["v5.1"]:
|
| 1879 |
sampler_dropdown = gr.Dropdown(
|
| 1880 |
-
label="Sampling method (
|
| 1881 |
choices=list(flow_scheduler_dict.keys()), value=list(flow_scheduler_dict.keys())[0]
|
| 1882 |
)
|
| 1883 |
else:
|
| 1884 |
sampler_dropdown = gr.Dropdown(
|
| 1885 |
-
label="Sampling method (
|
| 1886 |
choices=list(ddpm_scheduler_dict.keys()), value=list(ddpm_scheduler_dict.keys())[0]
|
| 1887 |
)
|
| 1888 |
sample_step_slider = gr.Slider(label="Sampling steps", value=40, minimum=10, maximum=40, step=1, interactive=False)
|
|
@@ -1906,8 +1904,8 @@ def ui_eas(edition, config_path, model_name, savedir_sample):
|
|
| 1906 |
value="Generate by",
|
| 1907 |
show_label=False,
|
| 1908 |
)
|
| 1909 |
-
width_slider = gr.Slider(label="Width (
|
| 1910 |
-
height_slider = gr.Slider(label="Height (
|
| 1911 |
base_resolution = gr.Radio(label="Base Resolution of Pretrained Models", value=512, choices=[512, 768, 960], interactive=False, visible=False)
|
| 1912 |
|
| 1913 |
with gr.Group():
|
|
@@ -1918,13 +1916,13 @@ def ui_eas(edition, config_path, model_name, savedir_sample):
|
|
| 1918 |
visible=True,
|
| 1919 |
)
|
| 1920 |
if edition in ["v2", "v3", "v4"]:
|
| 1921 |
-
length_slider = gr.Slider(label="Animation length (
|
| 1922 |
else:
|
| 1923 |
-
length_slider = gr.Slider(label="Animation length (
|
| 1924 |
|
| 1925 |
source_method = gr.Radio(
|
| 1926 |
-
["Text to Video (
|
| 1927 |
-
value="Text to Video (
|
| 1928 |
show_label=False,
|
| 1929 |
)
|
| 1930 |
with gr.Column(visible = False) as image_to_video_col:
|
|
@@ -1957,23 +1955,22 @@ def ui_eas(edition, config_path, model_name, savedir_sample):
|
|
| 1957 |
with gr.Column(visible = False) as video_to_video_col:
|
| 1958 |
with gr.Row():
|
| 1959 |
validation_video = gr.Video(
|
| 1960 |
-
label="The video to convert (
|
| 1961 |
elem_id="v2v", sources="upload",
|
| 1962 |
)
|
| 1963 |
-
with gr.Accordion("The mask of the video to inpaint (
|
| 1964 |
gr.Markdown(
|
| 1965 |
"""
|
| 1966 |
- Please set a larger denoise_strength when using validation_video_mask, such as 1.00 instead of 0.70
|
| 1967 |
-
- (请设置更大的denoise_strength,当使用validation_video_mask的时候,比如1而不是0.70)
|
| 1968 |
"""
|
| 1969 |
)
|
| 1970 |
validation_video_mask = gr.Image(
|
| 1971 |
-
label="The mask of the video to inpaint (
|
| 1972 |
show_label=False, elem_id="v2v_mask", sources="upload", type="filepath"
|
| 1973 |
)
|
| 1974 |
-
denoise_strength = gr.Slider(label="Denoise strength (
|
| 1975 |
|
| 1976 |
-
cfg_scale_slider = gr.Slider(label="CFG Scale (
|
| 1977 |
|
| 1978 |
with gr.Row():
|
| 1979 |
seed_textbox = gr.Textbox(label="Seed", value=43)
|
|
@@ -2015,9 +2012,9 @@ def ui_eas(edition, config_path, model_name, savedir_sample):
|
|
| 2015 |
)
|
| 2016 |
|
| 2017 |
def upload_source_method(source_method):
|
| 2018 |
-
if source_method == "Text to Video (
|
| 2019 |
return [gr.update(visible=False), gr.update(visible=False), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update(value=None)]
|
| 2020 |
-
elif source_method == "Image to Video (
|
| 2021 |
return [gr.update(visible=True), gr.update(visible=False), gr.update(), gr.update(), gr.update(value=None), gr.update(value=None)]
|
| 2022 |
else:
|
| 2023 |
return [gr.update(visible=False), gr.update(visible=True), gr.update(value=None), gr.update(value=None), gr.update(), gr.update()]
|
|
|
|
| 673 |
with gr.Column(variant="panel"):
|
| 674 |
gr.Markdown(
|
| 675 |
"""
|
| 676 |
+
### 1. EasyAnimate Model Type ().
|
| 677 |
"""
|
| 678 |
)
|
| 679 |
with gr.Row():
|
| 680 |
model_type = gr.Dropdown(
|
| 681 |
+
label="The model type of EasyAnimate ()",
|
| 682 |
choices=["Inpaint", "Control"],
|
| 683 |
value="Inpaint",
|
| 684 |
interactive=True,
|
|
|
|
| 691 |
)
|
| 692 |
with gr.Row():
|
| 693 |
easyanimate_edition_dropdown = gr.Dropdown(
|
| 694 |
+
label="The config of EasyAnimate Edition )",
|
| 695 |
choices=["v1", "v2", "v3", "v4", "v5", "v5.1"],
|
| 696 |
value="v5.1",
|
| 697 |
interactive=True,
|
|
|
|
| 703 |
)
|
| 704 |
with gr.Row():
|
| 705 |
diffusion_transformer_dropdown = gr.Dropdown(
|
| 706 |
+
label="Pretrained Model Path ()",
|
| 707 |
choices=controller.diffusion_transformer_list,
|
| 708 |
value="none",
|
| 709 |
interactive=True,
|
|
|
|
| 722 |
|
| 723 |
with gr.Row():
|
| 724 |
motion_module_dropdown = gr.Dropdown(
|
| 725 |
+
label="Select motion module ([])",
|
| 726 |
choices=controller.motion_module_list,
|
| 727 |
value="none",
|
| 728 |
interactive=True,
|
|
|
|
| 736 |
motion_module_refresh_button.click(fn=update_motion_module, inputs=[], outputs=[motion_module_dropdown])
|
| 737 |
|
| 738 |
base_model_dropdown = gr.Dropdown(
|
| 739 |
+
label="Select base Dreambooth model ([])",
|
| 740 |
choices=controller.personalized_model_list,
|
| 741 |
value="none",
|
| 742 |
interactive=True,
|
|
|
|
| 749 |
interactive=True,
|
| 750 |
)
|
| 751 |
|
| 752 |
+
lora_alpha_slider = gr.Slider(label="LoRA alpha ()", value=0.55, minimum=0, maximum=2, interactive=True)
|
| 753 |
|
| 754 |
personalized_refresh_button = gr.Button(value="\U0001F503", elem_classes="toolbutton")
|
| 755 |
def update_personalized_model():
|
|
|
|
| 763 |
with gr.Column(variant="panel"):
|
| 764 |
gr.Markdown(
|
| 765 |
"""
|
| 766 |
+
### 3. Configs for Generation ().
|
| 767 |
"""
|
| 768 |
)
|
| 769 |
|
| 770 |
+
prompt_textbox = gr.Textbox(label="Prompt ()", lines=2, value="A young woman with beautiful, clear eyes and blonde hair stands in the forest, wearing a white dress and a crown. Her expression is serene, reminiscent of a movie star, with fair and youthful skin. Her brown long hair flows in the wind. The video quality is very high, with a clear view. High quality, masterpiece, best quality, high resolution, ultra-fine, fantastical.")
|
| 771 |
gr.Markdown(
|
| 772 |
"""
|
| 773 |
Using longer neg prompt such as "Blurring, mutation, deformation, distortion, dark and solid, comics, text subtitles, line art." can increase stability. Adding words such as "quiet, solid" to the neg prompt can increase dynamism.
|
| 774 |
+
|
| 775 |
"""
|
| 776 |
)
|
| 777 |
+
negative_prompt_textbox = gr.Textbox(label="Negative prompt ()", lines=2, value="Twisted body, limb deformities, text captions, comic, static, ugly, error, messy code." )
|
| 778 |
|
| 779 |
with gr.Row():
|
| 780 |
with gr.Column():
|
| 781 |
with gr.Row():
|
| 782 |
sampler_dropdown = gr.Dropdown(
|
| 783 |
+
label="Sampling method ()",
|
| 784 |
choices=list(flow_scheduler_dict.keys()), value=list(flow_scheduler_dict.keys())[0]
|
| 785 |
)
|
| 786 |
+
sample_step_slider = gr.Slider(label="Sampling steps ()", value=50, minimum=10, maximum=100, step=1)
|
| 787 |
|
| 788 |
resize_method = gr.Radio(
|
| 789 |
["Generate by", "Resize according to Reference"],
|
| 790 |
value="Generate by",
|
| 791 |
show_label=False,
|
| 792 |
)
|
| 793 |
+
width_slider = gr.Slider(label="Width ()", value=672, minimum=128, maximum=1344, step=16)
|
| 794 |
+
height_slider = gr.Slider(label="Height ()", value=384, minimum=128, maximum=1344, step=16)
|
| 795 |
base_resolution = gr.Radio(label="Base Resolution of Pretrained Models", value=512, choices=[512, 768, 960], visible=False)
|
| 796 |
|
| 797 |
with gr.Group():
|
|
|
|
| 801 |
show_label=False,
|
| 802 |
)
|
| 803 |
with gr.Row():
|
| 804 |
+
length_slider = gr.Slider(label="Animation length ()", value=49, minimum=1, maximum=49, step=4)
|
| 805 |
+
overlap_video_length = gr.Slider(label="Overlap length ()", value=4, minimum=1, maximum=4, step=1, visible=False)
|
| 806 |
+
partial_video_length = gr.Slider(label="Partial video generation length ()", value=25, minimum=5, maximum=49, step=4, visible=False)
|
| 807 |
|
| 808 |
source_method = gr.Radio(
|
| 809 |
+
["Text to Video ()", "Image to Video (图片到视频)", "Video to Video ()", "Video Control (视频控制)"],
|
| 810 |
+
value="Text to Video ()",
|
| 811 |
show_label=False,
|
| 812 |
)
|
| 813 |
with gr.Column(visible = False) as image_to_video_col:
|
| 814 |
start_image = gr.Image(
|
| 815 |
+
label="The image at the beginning of the video ()", show_label=True,
|
| 816 |
elem_id="i2v_start", sources="upload", type="filepath",
|
| 817 |
)
|
| 818 |
|
|
|
|
| 837 |
)
|
| 838 |
template_gallery.select(select_template, None, [start_image, prompt_textbox])
|
| 839 |
|
| 840 |
+
with gr.Accordion("The image at the ending of the video ([, Optional])", open=False):
|
| 841 |
+
end_image = gr.Image(label="The image at the ending of the video ([, Optional])", show_label=False, elem_id="i2v_end", sources="upload", type="filepath")
|
| 842 |
|
| 843 |
with gr.Column(visible = False) as video_to_video_col:
|
| 844 |
with gr.Row():
|
| 845 |
validation_video = gr.Video(
|
| 846 |
+
label="The video to convert ()", show_label=True,
|
| 847 |
elem_id="v2v", sources="upload",
|
| 848 |
)
|
| 849 |
+
with gr.Accordion("The mask of the video to inpaint ([, Optional])", open=False):
|
| 850 |
gr.Markdown(
|
| 851 |
"""
|
| 852 |
- Please set a larger denoise_strength when using validation_video_mask, such as 1.00 instead of 0.70
|
| 853 |
+
- (请设置更大的denoise_strength,,.70)
|
| 854 |
"""
|
| 855 |
)
|
| 856 |
validation_video_mask = gr.Image(
|
| 857 |
+
label="The mask of the video to inpaint ([, Optional])",
|
| 858 |
show_label=False, elem_id="v2v_mask", sources="upload", type="filepath"
|
| 859 |
)
|
| 860 |
+
denoise_strength = gr.Slider(label="Denoise strength ()", value=0.70, minimum=0.10, maximum=1.00, step=0.01)
|
| 861 |
|
| 862 |
with gr.Column(visible = False) as control_video_col:
|
| 863 |
gr.Markdown(
|
|
|
|
| 867 |
"""
|
| 868 |
)
|
| 869 |
control_video = gr.Video(
|
| 870 |
+
label="The control video ()", show_label=True,
|
| 871 |
elem_id="v2v_control", sources="upload",
|
| 872 |
)
|
| 873 |
|
| 874 |
+
cfg_scale_slider = gr.Slider(label="CFG Scale ()", value=6.0, minimum=0, maximum=20)
|
| 875 |
|
| 876 |
with gr.Row():
|
| 877 |
+
seed_textbox = gr.Textbox(label="Seed ()", value=43)
|
| 878 |
seed_button = gr.Button(value="\U0001F3B2", elem_classes="toolbutton")
|
| 879 |
seed_button.click(
|
| 880 |
fn=lambda: gr.Textbox(value=random.randint(1, 1e8)) if gradio_version_is_above_4 else gr.Textbox.update(value=random.randint(1, 1e8)),
|
|
|
|
| 882 |
outputs=[seed_textbox]
|
| 883 |
)
|
| 884 |
|
| 885 |
+
generate_button = gr.Button(value="Generate ()", variant='primary')
|
| 886 |
|
| 887 |
with gr.Column():
|
| 888 |
+
result_image = gr.Image(label="Generated Image ()", interactive=False, visible=False)
|
| 889 |
+
result_video = gr.Video(label="Generated Animation ()", interactive=False)
|
| 890 |
infer_progress = gr.Textbox(
|
| 891 |
label="Generation Info (生成信息)",
|
| 892 |
value="No task currently",
|
|
|
|
| 921 |
)
|
| 922 |
|
| 923 |
def upload_source_method(source_method):
|
| 924 |
+
if source_method == "Text to Video ()":
|
| 925 |
return [gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update(value=None)]
|
| 926 |
+
elif source_method == "Image to Video ()":
|
| 927 |
return [gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(), gr.update(), gr.update(value=None), gr.update(value=None), gr.update(value=None)]
|
| 928 |
+
elif source_method == "Video to Video ()":
|
| 929 |
return [gr.update(visible=False), gr.update(visible=True), gr.update(visible=False), gr.update(value=None), gr.update(value=None), gr.update(), gr.update(), gr.update(value=None)]
|
| 930 |
else:
|
| 931 |
return [gr.update(visible=False), gr.update(visible=False), gr.update(visible=True), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update()]
|
|
|
|
| 1385 |
with gr.Column(variant="panel"):
|
| 1386 |
gr.Markdown(
|
| 1387 |
"""
|
| 1388 |
+
### 1. Model checkpoints ().
|
| 1389 |
"""
|
| 1390 |
)
|
| 1391 |
with gr.Row():
|
| 1392 |
diffusion_transformer_dropdown = gr.Dropdown(
|
| 1393 |
+
label="Pretrained Model Path ()",
|
| 1394 |
choices=[model_name],
|
| 1395 |
value=model_name,
|
| 1396 |
interactive=False,
|
| 1397 |
)
|
| 1398 |
with gr.Row():
|
| 1399 |
motion_module_dropdown = gr.Dropdown(
|
| 1400 |
+
label="Select motion module ([])",
|
| 1401 |
choices=["none"],
|
| 1402 |
value="none",
|
| 1403 |
interactive=False,
|
| 1404 |
visible=False
|
| 1405 |
)
|
| 1406 |
base_model_dropdown = gr.Dropdown(
|
| 1407 |
+
label="Select base Dreambooth model ([])",
|
| 1408 |
choices=["none"],
|
| 1409 |
value="none",
|
| 1410 |
interactive=False,
|
|
|
|
| 1424 |
interactive=False,
|
| 1425 |
)
|
| 1426 |
|
| 1427 |
+
lora_alpha_slider = gr.Slider(label="LoRA alpha ()", value=0.55, minimum=0, maximum=2, interactive=True)
|
| 1428 |
|
| 1429 |
with gr.Column(variant="panel"):
|
| 1430 |
gr.Markdown(
|
| 1431 |
"""
|
| 1432 |
+
### 2. Configs for Generation ().
|
| 1433 |
"""
|
| 1434 |
)
|
| 1435 |
|
| 1436 |
+
prompt_textbox = gr.Textbox(label="Prompt ()", lines=2, value="A young woman with beautiful, clear eyes and blonde hair stands in the forest, wearing a white dress and a crown. Her expression is serene, reminiscent of a movie star, with fair and youthful skin. Her brown long hair flows in the wind. The video quality is very high, with a clear view. High quality, masterpiece, best quality, high resolution, ultra-fine, fantastical.")
|
| 1437 |
gr.Markdown(
|
| 1438 |
"""
|
| 1439 |
Using longer neg prompt such as "Blurring, mutation, deformation, distortion, dark and solid, comics, text subtitles, line art." can increase stability. Adding words such as "quiet, solid" to the neg prompt can increase dynamism.
|
|
|
|
| 1440 |
"""
|
| 1441 |
)
|
| 1442 |
+
negative_prompt_textbox = gr.Textbox(label="Negative prompt ()", lines=2, value="Twisted body, limb deformities, text captions, comic, static, ugly, error, messy code." )
|
| 1443 |
|
| 1444 |
with gr.Row():
|
| 1445 |
with gr.Column():
|
| 1446 |
with gr.Row():
|
| 1447 |
if edition in ["v5.1"]:
|
| 1448 |
sampler_dropdown = gr.Dropdown(
|
| 1449 |
+
label="Sampling method ()",
|
| 1450 |
choices=list(flow_scheduler_dict.keys()), value=list(flow_scheduler_dict.keys())[0]
|
| 1451 |
)
|
| 1452 |
else:
|
| 1453 |
sampler_dropdown = gr.Dropdown(
|
| 1454 |
+
label="Sampling method ()",
|
| 1455 |
choices=list(ddpm_scheduler_dict.keys()), value=list(ddpm_scheduler_dict.keys())[0]
|
| 1456 |
)
|
| 1457 |
+
sample_step_slider = gr.Slider(label="Sampling steps ()", value=50, minimum=10, maximum=50, step=1, interactive=False)
|
| 1458 |
|
| 1459 |
if edition == "v1":
|
| 1460 |
+
width_slider = gr.Slider(label="Width ()", value=512, minimum=384, maximum=704, step=32)
|
| 1461 |
+
height_slider = gr.Slider(label="Height ()", value=512, minimum=384, maximum=704, step=32)
|
| 1462 |
|
| 1463 |
with gr.Group():
|
| 1464 |
generation_method = gr.Radio(
|
|
|
|
| 1467 |
show_label=False,
|
| 1468 |
visible=False,
|
| 1469 |
)
|
| 1470 |
+
length_slider = gr.Slider(label="Animation length ()", value=80, minimum=40, maximum=96, step=1)
|
| 1471 |
+
overlap_video_length = gr.Slider(label="Overlap length ()", value=4, minimum=1, maximum=4, step=1, visible=False)
|
| 1472 |
+
partial_video_length = gr.Slider(label="Partial video generation length ()", value=72, minimum=8, maximum=144, step=8, visible=False)
|
| 1473 |
+
cfg_scale_slider = gr.Slider(label="CFG Scale ()", value=6.0, minimum=0, maximum=20)
|
| 1474 |
else:
|
| 1475 |
resize_method = gr.Radio(
|
| 1476 |
["Generate by", "Resize according to Reference"],
|
| 1477 |
value="Generate by",
|
| 1478 |
show_label=False,
|
| 1479 |
)
|
| 1480 |
+
width_slider = gr.Slider(label="Width ()", value=672, minimum=128, maximum=1344, step=16, interactive=False)
|
| 1481 |
+
height_slider = gr.Slider(label="Height ()", value=384, minimum=128, maximum=1344, step=16, interactive=False)
|
| 1482 |
base_resolution = gr.Radio(label="Base Resolution of Pretrained Models", value=512, choices=[512, 768, 960], interactive=False, visible=False)
|
| 1483 |
|
| 1484 |
with gr.Group():
|
|
|
|
| 1489 |
visible=True,
|
| 1490 |
)
|
| 1491 |
if edition in ["v2", "v3", "v4"]:
|
| 1492 |
+
length_slider = gr.Slider(label="Animation length ()", value=144, minimum=8, maximum=144, step=8)
|
| 1493 |
else:
|
| 1494 |
+
length_slider = gr.Slider(label="Animation length ()", value=49, minimum=5, maximum=49, step=4)
|
| 1495 |
+
overlap_video_length = gr.Slider(label="Overlap length ()", value=4, minimum=1, maximum=4, step=1, visible=False)
|
| 1496 |
+
partial_video_length = gr.Slider(label="Partial video generation length ()", value=72, minimum=8, maximum=144, step=8, visible=False)
|
| 1497 |
|
| 1498 |
source_method = gr.Radio(
|
| 1499 |
+
["Text to Video ()", "Image to Video ()", "Video to Video ()", "Video Control ()"],
|
| 1500 |
+
value="Text to Video ()",
|
| 1501 |
show_label=False,
|
| 1502 |
)
|
| 1503 |
with gr.Column(visible = False) as image_to_video_col:
|
| 1504 |
with gr.Row():
|
| 1505 |
+
start_image = gr.Image(label="The image at the beginning of the video ()", show_label=True, elem_id="i2v_start", sources="upload", type="filepath")
|
| 1506 |
|
| 1507 |
template_gallery_path = ["asset/1.png", "asset/2.png", "asset/3.png", "asset/4.png", "asset/5.png"]
|
| 1508 |
def select_template(evt: gr.SelectData):
|
|
|
|
| 1525 |
)
|
| 1526 |
template_gallery.select(select_template, None, [start_image, prompt_textbox])
|
| 1527 |
|
| 1528 |
+
with gr.Accordion("The image at the ending of the video ([, Optional])", open=False):
|
| 1529 |
+
end_image = gr.Image(label="The image at the ending of the video ([, Optional])", show_label=False, elem_id="i2v_end", sources="upload", type="filepath")
|
| 1530 |
|
| 1531 |
with gr.Column(visible = False) as video_to_video_col:
|
| 1532 |
with gr.Row():
|
| 1533 |
validation_video = gr.Video(
|
| 1534 |
+
label="The video to convert ()", show_label=True,
|
| 1535 |
elem_id="v2v", sources="upload",
|
| 1536 |
)
|
| 1537 |
+
with gr.Accordion("The mask of the video to inpaint (, Optional])", open=False):
|
| 1538 |
gr.Markdown(
|
| 1539 |
"""
|
| 1540 |
- Please set a larger denoise_strength when using validation_video_mask, such as 1.00 instead of 0.70
|
| 1541 |
+
- (,,.70)
|
| 1542 |
"""
|
| 1543 |
)
|
| 1544 |
validation_video_mask = gr.Image(
|
| 1545 |
+
label="The mask of the video to inpaint ([, Optional])",
|
| 1546 |
show_label=False, elem_id="v2v_mask", sources="upload", type="filepath"
|
| 1547 |
)
|
| 1548 |
+
denoise_strength = gr.Slider(label="Denoise strength ()", value=0.70, minimum=0.10, maximum=1.00, step=0.01)
|
| 1549 |
|
| 1550 |
with gr.Column(visible = False) as control_video_col:
|
| 1551 |
gr.Markdown(
|
|
|
|
| 1555 |
"""
|
| 1556 |
)
|
| 1557 |
control_video = gr.Video(
|
| 1558 |
+
label="The control video ()", show_label=True,
|
| 1559 |
elem_id="v2v_control", sources="upload",
|
| 1560 |
)
|
| 1561 |
|
| 1562 |
+
cfg_scale_slider = gr.Slider(label="CFG Scale ()", value=6.0, minimum=0, maximum=20)
|
| 1563 |
|
| 1564 |
with gr.Row():
|
| 1565 |
+
seed_textbox = gr.Textbox(label="Seed ()", value=43)
|
| 1566 |
seed_button = gr.Button(value="\U0001F3B2", elem_classes="toolbutton")
|
| 1567 |
seed_button.click(
|
| 1568 |
fn=lambda: gr.Textbox(value=random.randint(1, 1e8)) if gradio_version_is_above_4 else gr.Textbox.update(value=random.randint(1, 1e8)),
|
|
|
|
| 1570 |
outputs=[seed_textbox]
|
| 1571 |
)
|
| 1572 |
|
| 1573 |
+
generate_button = gr.Button(value="Generate ()", variant='primary')
|
| 1574 |
|
| 1575 |
with gr.Column():
|
| 1576 |
+
result_image = gr.Image(label="Generated Image ()", interactive=False, visible=False)
|
| 1577 |
+
result_video = gr.Video(label="Generated Animation ()", interactive=False)
|
| 1578 |
infer_progress = gr.Textbox(
|
| 1579 |
+
label="Generation Info ()",
|
| 1580 |
value="No task currently",
|
| 1581 |
interactive=False
|
| 1582 |
)
|
|
|
|
| 1601 |
)
|
| 1602 |
|
| 1603 |
def upload_source_method(source_method):
|
| 1604 |
+
if source_method == "Text to Video )":
|
| 1605 |
return [gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update(value=None)]
|
| 1606 |
+
elif source_method == "Image to Video )":
|
| 1607 |
return [gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(), gr.update(), gr.update(value=None), gr.update(value=None), gr.update(value=None)]
|
| 1608 |
+
elif source_method == "Video to Video )":
|
| 1609 |
return [gr.update(visible=False), gr.update(visible=True), gr.update(visible=False), gr.update(value=None), gr.update(value=None), gr.update(), gr.update(), gr.update(value=None)]
|
| 1610 |
else:
|
| 1611 |
return [gr.update(visible=False), gr.update(visible=False), gr.update(visible=True), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update()]
|
|
|
|
| 1853 |
interactive=False,
|
| 1854 |
)
|
| 1855 |
|
| 1856 |
+
lora_alpha_slider = gr.Slider(label="LoRA alpha ()", value=0.55, minimum=0, maximum=2, interactive=True)
|
| 1857 |
|
| 1858 |
with gr.Column(variant="panel"):
|
| 1859 |
gr.Markdown(
|
|
|
|
| 1866 |
gr.Markdown(
|
| 1867 |
"""
|
| 1868 |
Using longer neg prompt such as "Blurring, mutation, deformation, distortion, dark and solid, comics, text subtitles, line art." can increase stability. Adding words such as "quiet, solid" to the neg prompt can increase dynamism.
|
|
|
|
| 1869 |
"""
|
| 1870 |
)
|
| 1871 |
negative_prompt_textbox = gr.Textbox(label="Negative prompt", lines=2, value="Twisted body, limb deformities, text captions, comic, static, ugly, error, messy code." )
|
|
|
|
| 1875 |
with gr.Row():
|
| 1876 |
if edition in ["v5.1"]:
|
| 1877 |
sampler_dropdown = gr.Dropdown(
|
| 1878 |
+
label="Sampling method ()",
|
| 1879 |
choices=list(flow_scheduler_dict.keys()), value=list(flow_scheduler_dict.keys())[0]
|
| 1880 |
)
|
| 1881 |
else:
|
| 1882 |
sampler_dropdown = gr.Dropdown(
|
| 1883 |
+
label="Sampling method ()",
|
| 1884 |
choices=list(ddpm_scheduler_dict.keys()), value=list(ddpm_scheduler_dict.keys())[0]
|
| 1885 |
)
|
| 1886 |
sample_step_slider = gr.Slider(label="Sampling steps", value=40, minimum=10, maximum=40, step=1, interactive=False)
|
|
|
|
| 1904 |
value="Generate by",
|
| 1905 |
show_label=False,
|
| 1906 |
)
|
| 1907 |
+
width_slider = gr.Slider(label="Width ()", value=672, minimum=128, maximum=1344, step=16, interactive=False)
|
| 1908 |
+
height_slider = gr.Slider(label="Height ()", value=384, minimum=128, maximum=1344, step=16, interactive=False)
|
| 1909 |
base_resolution = gr.Radio(label="Base Resolution of Pretrained Models", value=512, choices=[512, 768, 960], interactive=False, visible=False)
|
| 1910 |
|
| 1911 |
with gr.Group():
|
|
|
|
| 1916 |
visible=True,
|
| 1917 |
)
|
| 1918 |
if edition in ["v2", "v3", "v4"]:
|
| 1919 |
+
length_slider = gr.Slider(label="Animation length ()", value=144, minimum=8, maximum=144, step=8)
|
| 1920 |
else:
|
| 1921 |
+
length_slider = gr.Slider(label="Animation length ()", value=21, minimum=5, maximum=21, step=4)
|
| 1922 |
|
| 1923 |
source_method = gr.Radio(
|
| 1924 |
+
["Text to Video ()", "Image to Video ()", "Video to Video ()"],
|
| 1925 |
+
value="Text to Video ()",
|
| 1926 |
show_label=False,
|
| 1927 |
)
|
| 1928 |
with gr.Column(visible = False) as image_to_video_col:
|
|
|
|
| 1955 |
with gr.Column(visible = False) as video_to_video_col:
|
| 1956 |
with gr.Row():
|
| 1957 |
validation_video = gr.Video(
|
| 1958 |
+
label="The video to convert ()", show_label=True,
|
| 1959 |
elem_id="v2v", sources="upload",
|
| 1960 |
)
|
| 1961 |
+
with gr.Accordion("The mask of the video to inpaint ([, Optional])", open=False):
|
| 1962 |
gr.Markdown(
|
| 1963 |
"""
|
| 1964 |
- Please set a larger denoise_strength when using validation_video_mask, such as 1.00 instead of 0.70
|
|
|
|
| 1965 |
"""
|
| 1966 |
)
|
| 1967 |
validation_video_mask = gr.Image(
|
| 1968 |
+
label="The mask of the video to inpaint ([, Optional])",
|
| 1969 |
show_label=False, elem_id="v2v_mask", sources="upload", type="filepath"
|
| 1970 |
)
|
| 1971 |
+
denoise_strength = gr.Slider(label="Denoise strength ()", value=0.70, minimum=0.10, maximum=1.00, step=0.01)
|
| 1972 |
|
| 1973 |
+
cfg_scale_slider = gr.Slider(label="CFG Scale ()", value=6.0, minimum=0, maximum=20)
|
| 1974 |
|
| 1975 |
with gr.Row():
|
| 1976 |
seed_textbox = gr.Textbox(label="Seed", value=43)
|
|
|
|
| 2012 |
)
|
| 2013 |
|
| 2014 |
def upload_source_method(source_method):
|
| 2015 |
+
if source_method == "Text to Video ()":
|
| 2016 |
return [gr.update(visible=False), gr.update(visible=False), gr.update(value=None), gr.update(value=None), gr.update(value=None), gr.update(value=None)]
|
| 2017 |
+
elif source_method == "Image to Video ()":
|
| 2018 |
return [gr.update(visible=True), gr.update(visible=False), gr.update(), gr.update(), gr.update(value=None), gr.update(value=None)]
|
| 2019 |
else:
|
| 2020 |
return [gr.update(visible=False), gr.update(visible=True), gr.update(value=None), gr.update(value=None), gr.update(), gr.update()]
|