Update app.py
Browse files
app.py
CHANGED
|
@@ -33,6 +33,8 @@ def prepare_image_and_mask(image, width, height, overlap_percentage, resize_opti
|
|
| 33 |
# Apply resize option using percentages
|
| 34 |
if resize_option == "Full":
|
| 35 |
resize_percentage = 100
|
|
|
|
|
|
|
| 36 |
elif resize_option == "50%":
|
| 37 |
resize_percentage = 50
|
| 38 |
elif resize_option == "33%":
|
|
@@ -224,13 +226,25 @@ with gr.Blocks(css=css) as demo:
|
|
| 224 |
value="9:16",
|
| 225 |
scale=2
|
| 226 |
)
|
| 227 |
-
|
| 228 |
alignment_dropdown = gr.Dropdown(
|
| 229 |
choices=["Middle", "Left", "Right", "Top", "Bottom"],
|
| 230 |
value="Middle",
|
| 231 |
-
label="Alignment"
|
| 232 |
)
|
| 233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
with gr.Accordion(label="Advanced settings", open=False) as settings_panel:
|
| 235 |
with gr.Column():
|
| 236 |
with gr.Row():
|
|
@@ -264,20 +278,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 264 |
with gr.Row():
|
| 265 |
overlap_left = gr.Checkbox(label="Overlap Left", value=True)
|
| 266 |
overlap_bottom = gr.Checkbox(label="Overlap Bottom", value=True)
|
| 267 |
-
with gr.Row():
|
| 268 |
-
resize_option = gr.Radio(
|
| 269 |
-
label="Resize input image",
|
| 270 |
-
choices=["Full", "50%", "33%", "25%", "Custom"],
|
| 271 |
-
value="Full"
|
| 272 |
-
)
|
| 273 |
-
custom_resize_percentage = gr.Slider(
|
| 274 |
-
label="Custom resize (%)",
|
| 275 |
-
minimum=1,
|
| 276 |
-
maximum=100,
|
| 277 |
-
step=1,
|
| 278 |
-
value=50,
|
| 279 |
-
visible=False
|
| 280 |
-
)
|
| 281 |
|
| 282 |
with gr.Column():
|
| 283 |
preview_button = gr.Button("Preview alignment and mask")
|
|
|
|
| 33 |
# Apply resize option using percentages
|
| 34 |
if resize_option == "Full":
|
| 35 |
resize_percentage = 100
|
| 36 |
+
elif resize_option == "75%":
|
| 37 |
+
resize_percentage = 75
|
| 38 |
elif resize_option == "50%":
|
| 39 |
resize_percentage = 50
|
| 40 |
elif resize_option == "33%":
|
|
|
|
| 226 |
value="9:16",
|
| 227 |
scale=2
|
| 228 |
)
|
|
|
|
| 229 |
alignment_dropdown = gr.Dropdown(
|
| 230 |
choices=["Middle", "Left", "Right", "Top", "Bottom"],
|
| 231 |
value="Middle",
|
| 232 |
+
label="Alignment",
|
| 233 |
)
|
| 234 |
+
resize_option = gr.Radio(
|
| 235 |
+
label="Resize input image",
|
| 236 |
+
info="For custom check advanced options",
|
| 237 |
+
choices=["Full", "75%", "50%", "33%", "25%", "Custom"],
|
| 238 |
+
value="Full"
|
| 239 |
+
)
|
| 240 |
+
custom_resize_percentage = gr.Slider(
|
| 241 |
+
label="Custom resize (%)",
|
| 242 |
+
minimum=1,
|
| 243 |
+
maximum=100,
|
| 244 |
+
step=1,
|
| 245 |
+
value=50,
|
| 246 |
+
visible=False
|
| 247 |
+
)
|
| 248 |
with gr.Accordion(label="Advanced settings", open=False) as settings_panel:
|
| 249 |
with gr.Column():
|
| 250 |
with gr.Row():
|
|
|
|
| 278 |
with gr.Row():
|
| 279 |
overlap_left = gr.Checkbox(label="Overlap Left", value=True)
|
| 280 |
overlap_bottom = gr.Checkbox(label="Overlap Bottom", value=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 281 |
|
| 282 |
with gr.Column():
|
| 283 |
preview_button = gr.Button("Preview alignment and mask")
|