Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -852,209 +852,194 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange") as iface:
|
|
| 852 |
img2vid_current_width = gr.State(value=512)
|
| 853 |
img2vid_current_num_frames = gr.State(value=257)
|
| 854 |
|
| 855 |
-
|
| 856 |
-
|
| 857 |
-
|
| 858 |
-
|
| 859 |
-
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
|
| 864 |
-
|
| 865 |
-
|
| 866 |
-
|
| 867 |
-
|
| 868 |
-
|
| 869 |
-
|
| 870 |
-
|
| 871 |
-
|
| 872 |
-
|
| 873 |
-
|
| 874 |
-
|
| 875 |
-
|
| 876 |
-
|
| 877 |
-
|
| 878 |
-
|
| 879 |
-
|
| 880 |
-
|
| 881 |
-
|
| 882 |
-
|
| 883 |
-
|
| 884 |
-
|
| 885 |
-
|
| 886 |
-
|
| 887 |
-
|
| 888 |
-
|
| 889 |
-
|
| 890 |
-
|
| 891 |
-
|
| 892 |
-
|
| 893 |
-
|
| 894 |
-
|
| 895 |
-
|
| 896 |
-
|
| 897 |
-
|
| 898 |
-
|
| 899 |
-
|
| 900 |
-
|
| 901 |
-
|
| 902 |
-
|
| 903 |
-
|
| 904 |
-
|
| 905 |
-
|
| 906 |
-
|
| 907 |
-
|
| 908 |
-
|
| 909 |
-
|
| 910 |
-
|
| 911 |
-
|
| 912 |
-
|
| 913 |
-
|
| 914 |
-
|
| 915 |
-
|
| 916 |
-
|
| 917 |
-
|
| 918 |
-
|
| 919 |
-
|
| 920 |
-
|
| 921 |
-
|
| 922 |
-
|
| 923 |
-
|
| 924 |
-
|
| 925 |
-
|
| 926 |
-
|
| 927 |
-
|
| 928 |
-
|
| 929 |
-
|
| 930 |
-
|
| 931 |
-
|
| 932 |
-
|
| 933 |
-
|
| 934 |
-
|
| 935 |
-
|
| 936 |
-
|
| 937 |
-
|
| 938 |
-
|
| 939 |
-
|
| 940 |
-
|
| 941 |
-
|
| 942 |
-
|
| 943 |
-
|
| 944 |
-
|
| 945 |
-
|
| 946 |
-
|
| 947 |
-
|
| 948 |
-
|
| 949 |
-
|
| 950 |
-
|
| 951 |
-
|
| 952 |
-
|
| 953 |
-
|
| 954 |
-
|
| 955 |
-
|
| 956 |
-
|
| 957 |
-
|
| 958 |
-
|
| 959 |
-
|
| 960 |
-
|
| 961 |
-
|
| 962 |
-
|
| 963 |
-
|
| 964 |
-
|
| 965 |
-
|
| 966 |
-
|
| 967 |
-
|
| 968 |
-
|
| 969 |
-
|
| 970 |
-
|
| 971 |
-
|
| 972 |
-
|
| 973 |
-
|
| 974 |
-
|
| 975 |
-
|
| 976 |
-
|
| 977 |
-
|
| 978 |
-
|
| 979 |
-
|
| 980 |
-
|
| 981 |
-
|
| 982 |
-
|
| 983 |
-
|
| 984 |
-
|
| 985 |
-
|
| 986 |
-
|
| 987 |
-
|
| 988 |
-
|
| 989 |
-
|
| 990 |
-
|
| 991 |
-
|
| 992 |
-
|
| 993 |
-
|
| 994 |
-
|
| 995 |
-
|
| 996 |
-
|
| 997 |
-
|
| 998 |
-
|
| 999 |
-
|
| 1000 |
-
|
| 1001 |
-
|
| 1002 |
-
|
| 1003 |
-
|
| 1004 |
-
|
| 1005 |
-
|
| 1006 |
-
|
| 1007 |
-
|
| 1008 |
-
|
| 1009 |
-
|
| 1010 |
-
|
| 1011 |
-
|
| 1012 |
-
|
| 1013 |
-
|
| 1014 |
-
|
| 1015 |
-
|
| 1016 |
-
|
| 1017 |
-
|
| 1018 |
-
|
| 1019 |
-
|
| 1020 |
-
|
| 1021 |
-
|
| 1022 |
-
|
| 1023 |
-
|
| 1024 |
-
|
| 1025 |
-
|
| 1026 |
-
|
| 1027 |
-
|
| 1028 |
-
|
| 1029 |
-
|
| 1030 |
-
|
| 1031 |
-
|
| 1032 |
-
|
| 1033 |
-
|
| 1034 |
-
|
| 1035 |
-
|
| 1036 |
-
|
| 1037 |
-
|
| 1038 |
-
|
| 1039 |
-
|
| 1040 |
-
|
| 1041 |
-
|
| 1042 |
-
|
| 1043 |
-
|
| 1044 |
-
|
| 1045 |
-
|
| 1046 |
-
# ν΅ν© μμ μΉμ
μΆκ°
|
| 1047 |
-
with gr.Row():
|
| 1048 |
-
with gr.Column(scale=1):
|
| 1049 |
-
# κΈ°μ‘΄μ scenario_inputκ³Ό analyze_btn μ μ§
|
| 1050 |
-
merge_videos_btn = gr.Button("ν΅ν© μμ μμ±", variant="primary", size="lg")
|
| 1051 |
-
|
| 1052 |
-
with gr.Column(scale=2):
|
| 1053 |
-
# κΈ°μ‘΄μ μΉμ
1-5 μ μ§
|
| 1054 |
-
|
| 1055 |
-
# ν΅ν© μμ μΆλ ₯ μΉμ
μΆκ°
|
| 1056 |
-
with gr.Row():
|
| 1057 |
-
merged_video_output = gr.Video(label="ν΅ν© μμ")
|
| 1058 |
|
| 1059 |
|
| 1060 |
# Text to Video Tab handlers
|
|
@@ -1132,7 +1117,9 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange") as iface:
|
|
| 1132 |
outputs=img2vid_output,
|
| 1133 |
)
|
| 1134 |
|
| 1135 |
-
|
|
|
|
|
|
|
| 1136 |
generate_script_btn.click(
|
| 1137 |
fn=generate_script,
|
| 1138 |
inputs=[script_topic],
|
|
@@ -1222,8 +1209,9 @@ with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange") as iface:
|
|
| 1222 |
],
|
| 1223 |
outputs=merged_video_output
|
| 1224 |
)
|
| 1225 |
-
|
| 1226 |
if __name__ == "__main__":
|
| 1227 |
-
|
| 1228 |
-
|
| 1229 |
-
|
|
|
|
|
|
| 852 |
img2vid_current_width = gr.State(value=512)
|
| 853 |
img2vid_current_num_frames = gr.State(value=257)
|
| 854 |
|
| 855 |
+
with gr.Tabs():
|
| 856 |
+
# Text to Video Tab
|
| 857 |
+
with gr.TabItem("ν
μ€νΈλ‘ λΉλμ€ λ§λ€κΈ°"):
|
| 858 |
+
with gr.Row():
|
| 859 |
+
with gr.Column():
|
| 860 |
+
txt2vid_prompt = gr.Textbox(
|
| 861 |
+
label="Step 1: ν둬ννΈ μ
λ ₯",
|
| 862 |
+
placeholder="μμ±νκ³ μΆμ λΉλμ€λ₯Ό μ€λͺ
νμΈμ (μ΅μ 50μ)...",
|
| 863 |
+
value="κ·μ¬μ΄ κ³ μμ΄",
|
| 864 |
+
lines=5,
|
| 865 |
+
)
|
| 866 |
+
txt2vid_enhance_toggle = Toggle(
|
| 867 |
+
label="ν둬ννΈ μ¦κ°",
|
| 868 |
+
value=False,
|
| 869 |
+
interactive=True,
|
| 870 |
+
)
|
| 871 |
+
txt2vid_negative_prompt = gr.Textbox(
|
| 872 |
+
label="Step 2: λ€κ±°ν°λΈ ν둬ννΈ μ
λ ₯",
|
| 873 |
+
placeholder="λΉλμ€μμ μνμ§ μλ μμλ₯Ό μ€λͺ
νμΈμ...",
|
| 874 |
+
value="low quality, worst quality, deformed, distorted, warped, motion smear, motion artifacts, fused fingers, incorrect anatomy, strange hands, unattractive",
|
| 875 |
+
lines=2,
|
| 876 |
+
visible=False
|
| 877 |
+
)
|
| 878 |
+
txt2vid_preset = gr.Dropdown(
|
| 879 |
+
choices=[p["label"] for p in preset_options],
|
| 880 |
+
value="[16:9] 512x320, 10.3μ΄",
|
| 881 |
+
label="Step 2: ν΄μλ ν리μ
μ ν",
|
| 882 |
+
)
|
| 883 |
+
txt2vid_frame_rate = gr.Slider(
|
| 884 |
+
label="Step 3: νλ μ λ μ΄νΈ",
|
| 885 |
+
minimum=21,
|
| 886 |
+
maximum=30,
|
| 887 |
+
step=1,
|
| 888 |
+
value=25,
|
| 889 |
+
visible=False
|
| 890 |
+
)
|
| 891 |
+
txt2vid_advanced = create_advanced_options()
|
| 892 |
+
txt2vid_generate = gr.Button(
|
| 893 |
+
"Step 3: λΉλμ€ μμ±",
|
| 894 |
+
variant="primary",
|
| 895 |
+
size="lg",
|
| 896 |
+
)
|
| 897 |
+
with gr.Column():
|
| 898 |
+
txt2vid_output = gr.Video(label="μμ±λ λΉλμ€")
|
| 899 |
+
|
| 900 |
+
|
| 901 |
+
# Image to Video Tab
|
| 902 |
+
with gr.TabItem("μ΄λ―Έμ§λ‘ λΉλμ€ λ§λ€κΈ°"):
|
| 903 |
+
with gr.Row():
|
| 904 |
+
with gr.Column():
|
| 905 |
+
img2vid_image = gr.Image(
|
| 906 |
+
type="filepath",
|
| 907 |
+
label="Step 1: μ
λ ₯ μ΄λ―Έμ§ μ
λ‘λ",
|
| 908 |
+
elem_id="image_upload",
|
| 909 |
+
)
|
| 910 |
+
img2vid_prompt = gr.Textbox(
|
| 911 |
+
label="Step 2: ν둬ννΈ μ
λ ₯",
|
| 912 |
+
placeholder="μ΄λ―Έμ§λ₯Ό μ΄λ»κ² μ λλ©μ΄μ
νν μ§ μ€λͺ
νμΈμ (μ΅μ 50μ)...",
|
| 913 |
+
value="κ·μ¬μ΄ κ³ μμ΄",
|
| 914 |
+
lines=5,
|
| 915 |
+
)
|
| 916 |
+
img2vid_enhance_toggle = Toggle(
|
| 917 |
+
label="ν둬ννΈ μ¦κ°",
|
| 918 |
+
value=False,
|
| 919 |
+
interactive=True,
|
| 920 |
+
)
|
| 921 |
+
img2vid_negative_prompt = gr.Textbox(
|
| 922 |
+
label="Step 3: λ€κ±°ν°λΈ ν둬ννΈ μ
λ ₯",
|
| 923 |
+
placeholder="λΉλμ€μμ μνμ§ μλ μμλ₯Ό μ€λͺ
νμΈμ...",
|
| 924 |
+
value="low quality, worst quality, deformed, distorted, warped, motion smear, motion artifacts, fused fingers, incorrect anatomy, strange hands, unattractive",
|
| 925 |
+
lines=2,
|
| 926 |
+
visible=False
|
| 927 |
+
)
|
| 928 |
+
img2vid_preset = gr.Dropdown(
|
| 929 |
+
choices=[p["label"] for p in preset_options],
|
| 930 |
+
value="[16:9] 512x320, 10.3μ΄",
|
| 931 |
+
label="Step 3: ν΄μλ ν리μ
μ ν",
|
| 932 |
+
)
|
| 933 |
+
img2vid_frame_rate = gr.Slider(
|
| 934 |
+
label="Step 4: νλ μ λ μ΄νΈ",
|
| 935 |
+
minimum=21,
|
| 936 |
+
maximum=30,
|
| 937 |
+
step=1,
|
| 938 |
+
value=25,
|
| 939 |
+
visible=False
|
| 940 |
+
)
|
| 941 |
+
img2vid_advanced = create_advanced_options()
|
| 942 |
+
img2vid_generate = gr.Button(
|
| 943 |
+
"Step 4: λΉλμ€ μμ±",
|
| 944 |
+
variant="primary",
|
| 945 |
+
size="lg",
|
| 946 |
+
)
|
| 947 |
+
with gr.Column():
|
| 948 |
+
img2vid_output = gr.Video(label="μμ±λ λΉλμ€")
|
| 949 |
+
|
| 950 |
+
|
| 951 |
+
# Scenario Tab
|
| 952 |
+
with gr.TabItem("μλ리μ€λ‘ λΉλμ€ λ§λ€κΈ°(μνΌ)"):
|
| 953 |
+
with gr.Row():
|
| 954 |
+
with gr.Column(scale=1):
|
| 955 |
+
script_topic = gr.Textbox(
|
| 956 |
+
label="μ€ν¬λ¦½νΈ μμ±",
|
| 957 |
+
placeholder="κ²¨μΈ μΌλ³Έ μ¨μ² μ¬νμ μ£Όμ λ‘ λ°μ λλμΌλ‘ μ€ν¬οΏ½οΏ½οΏ½νΈ μμ±νλΌ",
|
| 958 |
+
lines=2
|
| 959 |
+
)
|
| 960 |
+
generate_script_btn = gr.Button("μ€ν¬λ¦½νΈ μμ±", variant="primary")
|
| 961 |
+
|
| 962 |
+
scenario_input = gr.Textbox(
|
| 963 |
+
label="μμ μ€ν¬λ¦½νΈ μ
λ ₯",
|
| 964 |
+
placeholder="μ 체 μλ리μ€λ₯Ό μ
λ ₯νμΈμ...",
|
| 965 |
+
lines=10
|
| 966 |
+
)
|
| 967 |
+
scenario_preset = gr.Dropdown(
|
| 968 |
+
choices=[p["label"] for p in preset_options],
|
| 969 |
+
value="[16:9] 512x320, 10.3μ΄",
|
| 970 |
+
label="νλ©΄ ν¬κΈ° μ ν"
|
| 971 |
+
)
|
| 972 |
+
analyze_btn = gr.Button("μλλ¦¬μ€ λΆμ λ° ν둬ννΈ μμ±", variant="primary")
|
| 973 |
+
|
| 974 |
+
with gr.Column(scale=2):
|
| 975 |
+
with gr.Row():
|
| 976 |
+
# μΉμ
1
|
| 977 |
+
with gr.Column():
|
| 978 |
+
section1_prompt = gr.Textbox(
|
| 979 |
+
label="1. λ°°κ²½ λ° νμμ±",
|
| 980 |
+
lines=4
|
| 981 |
+
)
|
| 982 |
+
with gr.Row():
|
| 983 |
+
section1_regenerate = gr.Button("π ν둬ννΈ μμ±")
|
| 984 |
+
section1_generate = gr.Button("π μμ μμ±")
|
| 985 |
+
section1_video = gr.Video(label="μΉμ
1 μμ")
|
| 986 |
+
|
| 987 |
+
# μΉμ
2
|
| 988 |
+
with gr.Column():
|
| 989 |
+
section2_prompt = gr.Textbox(
|
| 990 |
+
label="2. ν₯λ―Έ μ λ°",
|
| 991 |
+
lines=4
|
| 992 |
+
)
|
| 993 |
+
with gr.Row():
|
| 994 |
+
section2_regenerate = gr.Button("π ν둬ννΈ μμ±")
|
| 995 |
+
section2_generate = gr.Button("π μμ μμ±")
|
| 996 |
+
section2_video = gr.Video(label="μΉμ
2 μμ")
|
| 997 |
+
|
| 998 |
+
|
| 999 |
+
|
| 1000 |
+
with gr.Row():
|
| 1001 |
+
# μΉμ
3
|
| 1002 |
+
with gr.Column():
|
| 1003 |
+
section3_prompt = gr.Textbox(
|
| 1004 |
+
label="3. ν΄κ²°μ±
μ μ",
|
| 1005 |
+
lines=4
|
| 1006 |
+
)
|
| 1007 |
+
with gr.Row():
|
| 1008 |
+
section3_regenerate = gr.Button("π ν둬ννΈ μμ±")
|
| 1009 |
+
section3_generate = gr.Button("π μμ μμ±")
|
| 1010 |
+
section3_video = gr.Video(label="μΉμ
3 μμ")
|
| 1011 |
+
|
| 1012 |
+
# μΉμ
4
|
| 1013 |
+
with gr.Column():
|
| 1014 |
+
section4_prompt = gr.Textbox(
|
| 1015 |
+
label="4. λ³Έλ‘ ",
|
| 1016 |
+
lines=4
|
| 1017 |
+
)
|
| 1018 |
+
with gr.Row():
|
| 1019 |
+
section4_regenerate = gr.Button("π ν둬ννΈ μμ±")
|
| 1020 |
+
section4_generate = gr.Button("π μμ μμ±")
|
| 1021 |
+
section4_video = gr.Video(label="μΉμ
4 μμ")
|
| 1022 |
+
|
| 1023 |
+
with gr.Row():
|
| 1024 |
+
# μΉμ
5
|
| 1025 |
+
with gr.Column():
|
| 1026 |
+
section5_prompt = gr.Textbox(
|
| 1027 |
+
label="5. κ²°λ‘ λ° κ°μ‘°",
|
| 1028 |
+
lines=4
|
| 1029 |
+
)
|
| 1030 |
+
with gr.Row():
|
| 1031 |
+
section5_regenerate = gr.Button("π ν둬ννΈ μμ±")
|
| 1032 |
+
section5_generate = gr.Button("π μμ μμ±")
|
| 1033 |
+
section5_video = gr.Video(label="μΉμ
5 μμ")
|
| 1034 |
+
|
| 1035 |
+
# ν΅ν© μμ μΉμ
|
| 1036 |
+
with gr.Row():
|
| 1037 |
+
with gr.Column(scale=1):
|
| 1038 |
+
merge_videos_btn = gr.Button("ν΅ν© μμ μμ±", variant="primary", size="lg")
|
| 1039 |
+
|
| 1040 |
+
with gr.Column(scale=2):
|
| 1041 |
+
with gr.Row():
|
| 1042 |
+
merged_video_output = gr.Video(label="ν΅ν© μμ")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1043 |
|
| 1044 |
|
| 1045 |
# Text to Video Tab handlers
|
|
|
|
| 1117 |
outputs=img2vid_output,
|
| 1118 |
)
|
| 1119 |
|
| 1120 |
+
|
| 1121 |
+
|
| 1122 |
+
# Scenario Tab handlers
|
| 1123 |
generate_script_btn.click(
|
| 1124 |
fn=generate_script,
|
| 1125 |
inputs=[script_topic],
|
|
|
|
| 1209 |
],
|
| 1210 |
outputs=merged_video_output
|
| 1211 |
)
|
| 1212 |
+
|
| 1213 |
if __name__ == "__main__":
|
| 1214 |
+
iface.queue(max_size=64, default_concurrency_limit=1, api_open=False).launch(
|
| 1215 |
+
share=True,
|
| 1216 |
+
show_api=False
|
| 1217 |
+
)
|