Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -271,25 +271,27 @@ with gr.Blocks(css=css) as demo:
|
|
271 |
|
272 |
with gr.Row():
|
273 |
with gr.Column(scale=2):
|
274 |
-
prompt_input = gr.Textbox(label="Prompt (Optional)")
|
275 |
with gr.Column(scale=1):
|
276 |
-
run_button = gr.Button("Generate")
|
277 |
-
|
278 |
with gr.Row():
|
279 |
target_ratio = gr.Radio(
|
280 |
label="Expected Ratio",
|
281 |
choices=["9:16", "16:9", "1:1", "Custom"],
|
282 |
-
value="
|
283 |
-
scale=2
|
|
|
284 |
)
|
285 |
|
286 |
alignment_dropdown = gr.Dropdown(
|
287 |
choices=["Middle", "Left", "Right", "Top", "Bottom"],
|
288 |
value="Middle",
|
289 |
-
label="Alignment"
|
|
|
290 |
)
|
291 |
|
292 |
-
with gr.Accordion(label="Advanced settings", open=False) as settings_panel:
|
293 |
with gr.Column():
|
294 |
with gr.Row():
|
295 |
width_slider = gr.Slider(
|
@@ -297,14 +299,14 @@ with gr.Blocks(css=css) as demo:
|
|
297 |
minimum=720,
|
298 |
maximum=1536,
|
299 |
step=8,
|
300 |
-
value=
|
301 |
)
|
302 |
height_slider = gr.Slider(
|
303 |
label="Height",
|
304 |
minimum=720,
|
305 |
maximum=1536,
|
306 |
step=8,
|
307 |
-
value=
|
308 |
)
|
309 |
with gr.Row():
|
310 |
num_inference_steps = gr.Slider(label="Steps", minimum=4, maximum=12, step=1, value=8)
|
@@ -312,43 +314,34 @@ with gr.Blocks(css=css) as demo:
|
|
312 |
label="Mask overlap width",
|
313 |
minimum=1,
|
314 |
maximum=50,
|
315 |
-
value=
|
316 |
step=1
|
317 |
)
|
318 |
with gr.Row():
|
319 |
resize_option = gr.Radio(
|
320 |
label="Resize input image",
|
321 |
choices=["Full", "1/2", "1/3", "1/4", "Custom"],
|
322 |
-
value="
|
323 |
)
|
324 |
custom_resize_size = gr.Slider(
|
325 |
label="Custom resize size",
|
326 |
minimum=64,
|
327 |
maximum=1024,
|
328 |
step=8,
|
329 |
-
value=
|
330 |
visible=False
|
331 |
)
|
332 |
with gr.Row():
|
333 |
-
num_iterations = gr.Slider(label="Number of iterations", minimum=2, maximum=
|
334 |
-
fps = gr.Slider(label="fps", minimum=1, maximum=24)
|
335 |
-
gr.Examples(
|
336 |
-
examples=[
|
337 |
-
["./examples/example_1.webp", 1280, 720, "Middle"],
|
338 |
-
["./examples/example_2.jpg", 1440, 810, "Left"],
|
339 |
-
["./examples/example_3.jpg", 1024, 1024, "Top"],
|
340 |
-
["./examples/example_3.jpg", 1024, 1024, "Bottom"],
|
341 |
-
],
|
342 |
-
inputs=[input_image, width_slider, height_slider, alignment_dropdown],
|
343 |
-
)
|
344 |
|
345 |
with gr.Column():
|
346 |
result = ImageSlider(
|
347 |
interactive=False,
|
348 |
label="Generated Image",
|
|
|
349 |
)
|
350 |
use_as_input_button = gr.Button("Use as Input Image", visible=False)
|
351 |
-
loop_button = gr.Button("Loop Outpainting")
|
352 |
video_output = gr.Video(label="Outpainting Video")
|
353 |
|
354 |
def use_output_as_input(output_image):
|
|
|
271 |
|
272 |
with gr.Row():
|
273 |
with gr.Column(scale=2):
|
274 |
+
prompt_input = gr.Textbox(label="Prompt (Optional)", visible=False)
|
275 |
with gr.Column(scale=1):
|
276 |
+
run_button = gr.Button("Generate", visible=False)
|
277 |
+
loop_button = gr.Button("Create outpainting video")
|
278 |
with gr.Row():
|
279 |
target_ratio = gr.Radio(
|
280 |
label="Expected Ratio",
|
281 |
choices=["9:16", "16:9", "1:1", "Custom"],
|
282 |
+
value="1:1",
|
283 |
+
scale=2,
|
284 |
+
visible=False
|
285 |
)
|
286 |
|
287 |
alignment_dropdown = gr.Dropdown(
|
288 |
choices=["Middle", "Left", "Right", "Top", "Bottom"],
|
289 |
value="Middle",
|
290 |
+
label="Alignment",
|
291 |
+
visible=False
|
292 |
)
|
293 |
|
294 |
+
with gr.Accordion(label="Advanced settings", open=False, visible=False) as settings_panel:
|
295 |
with gr.Column():
|
296 |
with gr.Row():
|
297 |
width_slider = gr.Slider(
|
|
|
299 |
minimum=720,
|
300 |
maximum=1536,
|
301 |
step=8,
|
302 |
+
value=1024,
|
303 |
)
|
304 |
height_slider = gr.Slider(
|
305 |
label="Height",
|
306 |
minimum=720,
|
307 |
maximum=1536,
|
308 |
step=8,
|
309 |
+
value=1024,
|
310 |
)
|
311 |
with gr.Row():
|
312 |
num_inference_steps = gr.Slider(label="Steps", minimum=4, maximum=12, step=1, value=8)
|
|
|
314 |
label="Mask overlap width",
|
315 |
minimum=1,
|
316 |
maximum=50,
|
317 |
+
value=4,
|
318 |
step=1
|
319 |
)
|
320 |
with gr.Row():
|
321 |
resize_option = gr.Radio(
|
322 |
label="Resize input image",
|
323 |
choices=["Full", "1/2", "1/3", "1/4", "Custom"],
|
324 |
+
value="Custom"
|
325 |
)
|
326 |
custom_resize_size = gr.Slider(
|
327 |
label="Custom resize size",
|
328 |
minimum=64,
|
329 |
maximum=1024,
|
330 |
step=8,
|
331 |
+
value=896,
|
332 |
visible=False
|
333 |
)
|
334 |
with gr.Row():
|
335 |
+
num_iterations = gr.Slider(label="Number of iterations", minimum=2, maximum=24, step=1, value=18)
|
336 |
+
fps = gr.Slider(label="fps", minimum=1, maximum=24, value=8)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
|
338 |
with gr.Column():
|
339 |
result = ImageSlider(
|
340 |
interactive=False,
|
341 |
label="Generated Image",
|
342 |
+
visible=False
|
343 |
)
|
344 |
use_as_input_button = gr.Button("Use as Input Image", visible=False)
|
|
|
345 |
video_output = gr.Video(label="Outpainting Video")
|
346 |
|
347 |
def use_output_as_input(output_image):
|