Spaces:
Running
on
Zero
Running
on
Zero
ai-forever
commited on
Commit
•
57e1311
1
Parent(s):
7ef5852
Update app.py
Browse files
app.py
CHANGED
@@ -125,6 +125,14 @@ def resize_image(image, output_size=(672, 384)):
|
|
125 |
return cropped_image
|
126 |
|
127 |
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
gr.Markdown('''# Community demo for Kandinsky 4.0 Flash''')
|
129 |
with gr.Row():
|
130 |
with gr.Column():
|
@@ -144,14 +152,15 @@ with gr.Blocks() as demo:
|
|
144 |
# gr.Markdown(
|
145 |
# "✨Upon pressing the enhanced prompt button, we will use [GigaChat Model](https://github.com/THUDM/GLM-4) to polish the prompt and overwrite the original one."
|
146 |
# )
|
147 |
-
|
148 |
label="Aspect ratio",
|
149 |
-
choices=["
|
150 |
-
value="16:9"
|
151 |
)
|
|
|
152 |
with gr.Column():
|
153 |
enhance_button = gr.Button("Beautify prompt with GigaChat-Max")
|
154 |
-
generate_btn = gr.Button("Generate")
|
155 |
|
156 |
# with gr.Accordion("Advanced options", open=False):
|
157 |
# seed = gr.Slider(label="Seed", value=42, randomize=True, minimum=0, maximum=max_64_bit_int, step=1)
|
@@ -199,7 +208,7 @@ with gr.Blocks() as demo:
|
|
199 |
return prompt
|
200 |
|
201 |
|
202 |
-
generate_btn.click(fn=sample, inputs=[prompt,
|
203 |
|
204 |
|
205 |
|
|
|
125 |
return cropped_image
|
126 |
|
127 |
with gr.Blocks() as demo:
|
128 |
+
aspect_ratio_variants = {
|
129 |
+
'16:9 (672x384)': '16:9',
|
130 |
+
'9:16 (384x672)': '9:16',
|
131 |
+
'1:1 (512x512)': '1:1',
|
132 |
+
'1:2 (352x736)': '1:2',
|
133 |
+
'2:1 (736x352)': '2:1'
|
134 |
+
}
|
135 |
+
|
136 |
gr.Markdown('''# Community demo for Kandinsky 4.0 Flash''')
|
137 |
with gr.Row():
|
138 |
with gr.Column():
|
|
|
152 |
# gr.Markdown(
|
153 |
# "✨Upon pressing the enhanced prompt button, we will use [GigaChat Model](https://github.com/THUDM/GLM-4) to polish the prompt and overwrite the original one."
|
154 |
# )
|
155 |
+
aspect_ratio = gr.Dropdown(
|
156 |
label="Aspect ratio",
|
157 |
+
choices=["16:9 (672x384)", "9:16 (384x672)", "1:1 (512x512)", "1:2 (352x736)", "2:1 (736x352)"],
|
158 |
+
value="16:9 (672x384)"
|
159 |
)
|
160 |
+
aspect_ratio = aspect_ratio_variants[aspect_ratio]
|
161 |
with gr.Column():
|
162 |
enhance_button = gr.Button("Beautify prompt with GigaChat-Max")
|
163 |
+
generate_btn = gr.Button("Generate Video")
|
164 |
|
165 |
# with gr.Accordion("Advanced options", open=False):
|
166 |
# seed = gr.Slider(label="Seed", value=42, randomize=True, minimum=0, maximum=max_64_bit_int, step=1)
|
|
|
208 |
return prompt
|
209 |
|
210 |
|
211 |
+
generate_btn.click(fn=sample, inputs=[prompt, aspect_ratio], outputs=[video], api_name="video")
|
212 |
|
213 |
|
214 |
|