Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -135,13 +135,30 @@ with gr.Blocks(css=css, title="ZenCtrl Inpainting") as demo:
|
|
| 135 |
bg_img = gr.Image(label="Background", visible=True)
|
| 136 |
|
| 137 |
# ---------- Example wrapper ---------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
def _load_and_show(subj_path, bg_path, prompt_text):
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
return (
|
| 141 |
-
Image.open(subj_path),
|
| 142 |
-
{"image": Image.open(bg_path), "mask": None},
|
| 143 |
-
prompt_text,
|
| 144 |
-
Image.open(out_path)
|
| 145 |
)
|
| 146 |
|
| 147 |
def ex(subj, bg, prompt):
|
|
|
|
| 135 |
bg_img = gr.Image(label="Background", visible=True)
|
| 136 |
|
| 137 |
# ---------- Example wrapper ---------------------------------
|
| 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 _load_and_show(subj_path, bg_path, prompt_text):
|
| 148 |
+
"""
|
| 149 |
+
Takes the three values coming from an Examples row
|
| 150 |
+
and returns FOUR objects β one for every output widget:
|
| 151 |
+
1. subject PIL image -> subj_img
|
| 152 |
+
2. dict for the sketch component -> ref_img
|
| 153 |
+
3. prompt string -> promptbox
|
| 154 |
+
4. pre-rendered result PIL -> output_img
|
| 155 |
+
"""
|
| 156 |
+
out_path = subj_path.replace(".png", "_out.png") # your saved result
|
| 157 |
return (
|
| 158 |
+
Image.open(subj_path), # 1οΈβ£ subject
|
| 159 |
+
{"image": Image.open(bg_path), "mask": None}, # 2οΈβ£ sketch dict
|
| 160 |
+
prompt_text, # 3οΈβ£ prompt
|
| 161 |
+
Image.open(out_path) # 4οΈβ£ output image
|
| 162 |
)
|
| 163 |
|
| 164 |
def ex(subj, bg, prompt):
|