Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -135,27 +135,35 @@ with gr.Blocks(css=css, title="ZenCtrl Inpainting") as demo:
|
|
| 135 |
bg_img = gr.Image(label="Background", visible=True)
|
| 136 |
|
| 137 |
# ---------- Example wrapper ---------------------------------
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
|
|
|
|
|
|
|
|
|
| 141 |
|
| 142 |
examples = [
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
["examples/car.png", "examples/car_bg.png", "car on the road"],
|
| 151 |
]
|
| 152 |
|
|
|
|
|
|
|
|
|
|
| 153 |
gr.Examples(
|
| 154 |
-
examples
|
| 155 |
-
inputs
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
|
|
|
|
|
|
|
|
|
| 159 |
)
|
| 160 |
|
| 161 |
# ---------- Buttons & interactions --------------------------
|
|
|
|
| 135 |
bg_img = gr.Image(label="Background", visible=True)
|
| 136 |
|
| 137 |
# ---------- Example wrapper ---------------------------------
|
| 138 |
+
def ex(subj, bg): # ← both string paths
|
| 139 |
+
return [
|
| 140 |
+
subj, # goes to subj_img (Image widget)
|
| 141 |
+
{"image": bg, "mask": None}, # goes to ref_img (sketch widget)
|
| 142 |
+
"prompt text here" # goes to promptbox (Textbox)
|
| 143 |
+
]
|
| 144 |
|
| 145 |
examples = [
|
| 146 |
+
ex("examples/sofa1.png", "examples/sofa1_bg.png")[:2] + ["add the sofa"],
|
| 147 |
+
ex("examples/sofa2.png", "examples/sofa2_bg.png")[:2] + ["add this sofa"],
|
| 148 |
+
ex("examples/chair1.png", "examples/chair1_bg.png")[:2] + ["add the chair"],
|
| 149 |
+
ex("examples/console_table.png", "examples/console_table_bg.png")[:2] +
|
| 150 |
+
["Scandinavian console table against a gallery-style wall filled with abstract framed art"],
|
| 151 |
+
ex("examples/office_chair.png", "examples/office_chair_bg.png")[:2] + ["office chair"],
|
| 152 |
+
ex("examples/car.png", "examples/car_bg.png")[:2] + ["car on the road"],
|
|
|
|
| 153 |
]
|
| 154 |
|
| 155 |
+
def identity(a, b, c): # just pass the filled widgets straight back
|
| 156 |
+
return a, b, c
|
| 157 |
+
|
| 158 |
gr.Examples(
|
| 159 |
+
examples = examples,
|
| 160 |
+
inputs = [subj_img, ref_img, promptbox],
|
| 161 |
+
outputs = [subj_img, ref_img, promptbox], # <- MUST match `identity`
|
| 162 |
+
fn = identity, # <- avoids missing table
|
| 163 |
+
cache_examples = False, # fine now
|
| 164 |
+
preprocess = False, # data already in widget form
|
| 165 |
+
label = "Visual Presets – Subject · Background · Prompt",
|
| 166 |
+
examples_per_page = "all",
|
| 167 |
)
|
| 168 |
|
| 169 |
# ---------- Buttons & interactions --------------------------
|