salso commited on
Commit
2f44119
Β·
verified Β·
1 Parent(s): c344750

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -5
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
- 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):
 
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):