Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -141,16 +141,8 @@ with gr.Blocks(css=css, title="ZenCtrl Inpainting") as demo:
|
|
| 141 |
bg_img = gr.Image(label="Background", visible=True)
|
| 142 |
|
| 143 |
# ---------- Example wrapper ---------------------------------
|
| 144 |
-
def
|
| 145 |
-
|
| 146 |
-
bg = Image.open(bg_path)
|
| 147 |
-
|
| 148 |
-
# Automatically infer output path from naming convention
|
| 149 |
-
# Replace `examples/sofa1.png` → `examples/sofa1_out.png`
|
| 150 |
-
output_path = subj_path.replace(".png", "_out.png")
|
| 151 |
-
result = Image.open(output_path)
|
| 152 |
-
|
| 153 |
-
return result, bg # or just `return result` if not showing background
|
| 154 |
|
| 155 |
# ---------- Examples ----------------------------------------
|
| 156 |
gr.Examples(
|
|
@@ -162,9 +154,9 @@ with gr.Blocks(css=css, title="ZenCtrl Inpainting") as demo:
|
|
| 162 |
["examples/office_chair.png", "examples/office_chair_bg.png", "office chair", "examples/office_chair_out.png"],
|
| 163 |
["examples/car.png", "examples/car_bg.png", "car on the road", "examples/car_out.png"],
|
| 164 |
],
|
| 165 |
-
inputs=[subj_img, ref_img, promptbox
|
| 166 |
-
|
| 167 |
-
|
| 168 |
label="Visual Presets: Subject · Background · Prompt · Output",
|
| 169 |
examples_per_page="all"
|
| 170 |
)
|
|
|
|
| 141 |
bg_img = gr.Image(label="Background", visible=True)
|
| 142 |
|
| 143 |
# ---------- Example wrapper ---------------------------------
|
| 144 |
+
def _load_and_show(subj_path, bg_path, prompt):
|
| 145 |
+
return Image.open(subj_path), Image.open(bg_path), prompt, Image.open(subj_path.replace(".png", "_out.png"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
|
| 147 |
# ---------- Examples ----------------------------------------
|
| 148 |
gr.Examples(
|
|
|
|
| 154 |
["examples/office_chair.png", "examples/office_chair_bg.png", "office chair", "examples/office_chair_out.png"],
|
| 155 |
["examples/car.png", "examples/car_bg.png", "car on the road", "examples/car_out.png"],
|
| 156 |
],
|
| 157 |
+
inputs=[subj_img, ref_img, promptbox],
|
| 158 |
+
outputs=[output_img],
|
| 159 |
+
fn=_load_and_show,
|
| 160 |
label="Visual Presets: Subject · Background · Prompt · Output",
|
| 161 |
examples_per_page="all"
|
| 162 |
)
|