Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -138,11 +138,18 @@ with gr.Blocks(css=css, title="ZenCtrl Inpainting") as demo:
|
|
| 138 |
def _load_and_show(subj_path, bg_path, prompt_text):
|
| 139 |
out_path = subj_path.replace(".png", "_out.png")
|
| 140 |
return (
|
| 141 |
-
Image.open(subj_path),
|
| 142 |
-
Image.open(bg_path),
|
| 143 |
-
prompt_text,
|
| 144 |
-
Image.open(out_path)
|
| 145 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
|
| 147 |
# ---------- Examples ----------------------------------------
|
| 148 |
gr.Examples(
|
|
@@ -154,13 +161,12 @@ with gr.Blocks(css=css, title="ZenCtrl Inpainting") as demo:
|
|
| 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=[subj_img, ref_img, promptbox, output_img],
|
| 159 |
-
fn=_load_and_show,
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
)
|
| 164 |
|
| 165 |
|
| 166 |
# ---------- Buttons & interactions --------------------------
|
|
|
|
| 138 |
def _load_and_show(subj_path, bg_path, prompt_text):
|
| 139 |
out_path = subj_path.replace(".png", "_out.png")
|
| 140 |
return (
|
| 141 |
+
Image.open(subj_path), # → gr.Image widget ok
|
| 142 |
+
{"image": Image.open(bg_path), "mask": None}, # ← **dict for sketch!**
|
| 143 |
+
prompt_text, # → gr.Textbox
|
| 144 |
+
Image.open(out_path) # → gr.Image output
|
| 145 |
+
)
|
| 146 |
+
|
| 147 |
+
def ex(subj, bg, prompt):
|
| 148 |
+
return [
|
| 149 |
+
Image.open(subj),
|
| 150 |
+
{"image": Image.open(bg), "mask": None},
|
| 151 |
+
prompt
|
| 152 |
+
]
|
| 153 |
|
| 154 |
# ---------- Examples ----------------------------------------
|
| 155 |
gr.Examples(
|
|
|
|
| 161 |
["examples/office_chair.png", "examples/office_chair_bg.png", "office chair"], #"examples/office_chair_out.png"],
|
| 162 |
["examples/car.png", "examples/car_bg.png", "car on the road"], #"examples/car_out.png"],
|
| 163 |
],
|
| 164 |
+
inputs = [subj_img, ref_img, promptbox],
|
| 165 |
+
outputs = [subj_img, ref_img, promptbox, output_img],
|
| 166 |
+
fn = _load_and_show,
|
| 167 |
+
preprocess = False, # data already widget-ready
|
| 168 |
+
cache_examples=False
|
| 169 |
+
)
|
|
|
|
| 170 |
|
| 171 |
|
| 172 |
# ---------- Buttons & interactions --------------------------
|