Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,16 +37,16 @@ for idx, name in enumerate(files):
|
|
| 37 |
ep = "assets/examples"
|
| 38 |
# Layout, Style, Color, Subject, Prompt,Strict Layout Edge,Layout Content Scale, Automatic Image Matting
|
| 39 |
image_examples = [
|
| 40 |
-
[0, f"{ep}/00_layout.png", f"{ep}/empty.png", f"{ep}/empty.png", f"{ep}/empty.png", "", True, 0.,
|
| 41 |
-
[1, f"{ep}/01_layout.png", f"{ep}/empty.png", f"{ep}/empty.png", f"{ep}/empty.png", "", True, 0.8,
|
| 42 |
-
[2, f"{ep}/empty.png", f"{ep}/02_style.png", f"{ep}/empty.png", f"{ep}/empty.png", "", True, 0.8,
|
| 43 |
-
[3, f"{ep}/empty.png", f"{ep}/03_style.png", f"{ep}/empty.png", f"{ep}/empty.png", "", True, 0.8,
|
| 44 |
-
[4, f"{ep}/empty.png", f"{ep}/empty.png", f"{ep}/04_color.png", f"{ep}/empty.png", "A moose, Merry Christmas", True, 0.8,
|
| 45 |
[5, f"{ep}/empty.png", f"{ep}/empty.png", f"{ep}/05_color.png", f"{ep}/empty.png", "A photo about cherry blossom",
|
| 46 |
-
True, 0.8,
|
| 47 |
-
[6, f"{ep}/06_layout.png", f"{ep}/06_style.jpeg", f"{ep}/empty.png", f"{ep}/empty.png", "", True, 0.8,
|
| 48 |
-
[7, f"{ep}/07_layout.jpeg", f"{ep}/07_style.jpeg", f"{ep}/empty.png", f"{ep}/empty.png", "", True, 0.8,
|
| 49 |
-
[8, f"{ep}/empty.png", f"{ep}/08_style.png", f"{ep}/08_color.jpeg", f"{ep}/empty.png", "", True, 0.8,
|
| 50 |
[9, f"{ep}/empty.png", f"{ep}/09_style.png", f"{ep}/empty.png", f"{ep}/base_image1.jpeg", "", True, 0.8, True],
|
| 51 |
[10, f"{ep}/10_layout.png", f"{ep}/10_style.png", f"{ep}/empty.png", f"{ep}/base_image2.png", "", True, 0.8, False],
|
| 52 |
[11, f"{ep}/11_layout.png", f"{ep}/empty.png", f"{ep}/empty.png", f"{ep}/base_image4.png", "", False, 0.8, False],
|
|
@@ -243,7 +243,7 @@ if __name__ == "__main__":
|
|
| 243 |
gr.Markdown("""
|
| 244 |
- ⭐️ <b>step1:</b> (Optional) Upload or select a set of images from the examples for the "Layout", "Style", and "Color" reference. Mix and match freely, no need to select all.
|
| 245 |
- ⭐️ <b>step2:</b> (Optional) Use brush to erase areas in the layout, style, and color reference images (if present) that you do not want transferred.
|
| 246 |
-
- ⭐️ <b>step3:</b> (Optional) Upload an image with the subject you wish to preserve at the pixel level
|
| 247 |
- ⭐️ <b>step4:</b> Click "Run" to start the generation process.
|
| 248 |
- ⭐️ <b>step5:</b> (Optional) Additionally, prompt input is supported, as well as control over advanced parameters such as layout edge consistency and conditional weights. Feel free to try these features.
|
| 249 |
""")
|
|
@@ -305,7 +305,7 @@ if __name__ == "__main__":
|
|
| 305 |
type="pil", image_mode="RGBA", tool="editor")
|
| 306 |
pil_base_image_rgba_mirror = gr.Image(label="Subject", image_mode="RGBA", visible=False)
|
| 307 |
with gr.Box():
|
| 308 |
-
preprocess_base_image = gr.Checkbox(label="Automatic Image Matting")
|
| 309 |
pil_fg_mask = gr.Image(interactive=False, type="pil", image_mode="L", visible=False)
|
| 310 |
run_button = gr.Button("Run", elem_id="btn")
|
| 311 |
with gr.Accordion("", open=True, elem_id="accordion1"):
|
|
|
|
| 37 |
ep = "assets/examples"
|
| 38 |
# Layout, Style, Color, Subject, Prompt,Strict Layout Edge,Layout Content Scale, Automatic Image Matting
|
| 39 |
image_examples = [
|
| 40 |
+
[0, f"{ep}/00_layout.png", f"{ep}/empty.png", f"{ep}/empty.png", f"{ep}/empty.png", "", True, 0., True],
|
| 41 |
+
[1, f"{ep}/01_layout.png", f"{ep}/empty.png", f"{ep}/empty.png", f"{ep}/empty.png", "", True, 0.8, True],
|
| 42 |
+
[2, f"{ep}/empty.png", f"{ep}/02_style.png", f"{ep}/empty.png", f"{ep}/empty.png", "", True, 0.8, True],
|
| 43 |
+
[3, f"{ep}/empty.png", f"{ep}/03_style.png", f"{ep}/empty.png", f"{ep}/empty.png", "", True, 0.8, True],
|
| 44 |
+
[4, f"{ep}/empty.png", f"{ep}/empty.png", f"{ep}/04_color.png", f"{ep}/empty.png", "A moose, Merry Christmas", True, 0.8, True],
|
| 45 |
[5, f"{ep}/empty.png", f"{ep}/empty.png", f"{ep}/05_color.png", f"{ep}/empty.png", "A photo about cherry blossom",
|
| 46 |
+
True, 0.8, True],
|
| 47 |
+
[6, f"{ep}/06_layout.png", f"{ep}/06_style.jpeg", f"{ep}/empty.png", f"{ep}/empty.png", "", True, 0.8, True],
|
| 48 |
+
[7, f"{ep}/07_layout.jpeg", f"{ep}/07_style.jpeg", f"{ep}/empty.png", f"{ep}/empty.png", "", True, 0.8, True],
|
| 49 |
+
[8, f"{ep}/empty.png", f"{ep}/08_style.png", f"{ep}/08_color.jpeg", f"{ep}/empty.png", "", True, 0.8, True],
|
| 50 |
[9, f"{ep}/empty.png", f"{ep}/09_style.png", f"{ep}/empty.png", f"{ep}/base_image1.jpeg", "", True, 0.8, True],
|
| 51 |
[10, f"{ep}/10_layout.png", f"{ep}/10_style.png", f"{ep}/empty.png", f"{ep}/base_image2.png", "", True, 0.8, False],
|
| 52 |
[11, f"{ep}/11_layout.png", f"{ep}/empty.png", f"{ep}/empty.png", f"{ep}/base_image4.png", "", False, 0.8, False],
|
|
|
|
| 243 |
gr.Markdown("""
|
| 244 |
- ⭐️ <b>step1:</b> (Optional) Upload or select a set of images from the examples for the "Layout", "Style", and "Color" reference. Mix and match freely, no need to select all.
|
| 245 |
- ⭐️ <b>step2:</b> (Optional) Use brush to erase areas in the layout, style, and color reference images (if present) that you do not want transferred.
|
| 246 |
+
- ⭐️ <b>step3:</b> (Optional) Upload an RGBA image to the "Subject" tab, with the alpha channel indicating the subject you wish to preserve at the pixel level (or upload a regular RGB image and check the automatic image matting option, which will automatically segment the subject for you; <b>the default is the latter</b>).
|
| 247 |
- ⭐️ <b>step4:</b> Click "Run" to start the generation process.
|
| 248 |
- ⭐️ <b>step5:</b> (Optional) Additionally, prompt input is supported, as well as control over advanced parameters such as layout edge consistency and conditional weights. Feel free to try these features.
|
| 249 |
""")
|
|
|
|
| 305 |
type="pil", image_mode="RGBA", tool="editor")
|
| 306 |
pil_base_image_rgba_mirror = gr.Image(label="Subject", image_mode="RGBA", visible=False)
|
| 307 |
with gr.Box():
|
| 308 |
+
preprocess_base_image = gr.Checkbox(label="Automatic Image Matting", value=True)
|
| 309 |
pil_fg_mask = gr.Image(interactive=False, type="pil", image_mode="L", visible=False)
|
| 310 |
run_button = gr.Button("Run", elem_id="btn")
|
| 311 |
with gr.Accordion("", open=True, elem_id="accordion1"):
|