salso commited on
Commit
0bb39a0
·
verified ·
1 Parent(s): aba3439

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -78,7 +78,7 @@ def process_image_and_text(subject_image, adapter_dict, prompt, _unused1, _unuse
78
  try:
79
  blended_bytes = base64.b64decode(data["blended"])
80
  raw_img = Image.open(BytesIO(blended_bytes)).convert("RGB")
81
- return [[raw_img]], raw_img
82
  except Exception:
83
  raise gr.Error("Failed to decode 'blended' image from Baseten response.")
84
  else:
@@ -128,7 +128,7 @@ with gr.Blocks(css=css, title="ZenCtrl Inpainting") as demo:
128
  bg_btn = gr.Button("Generate BG")
129
 
130
  with gr.Column(scale=2):
131
- gallery = gr.Gallery(columns=[1], rows=[1], object_fit="contain", height="auto")
132
  bg_img = gr.Image(label="Background", visible=True)
133
 
134
  # ---------- Example wrapper ---------------------------------
@@ -159,10 +159,15 @@ with gr.Blocks(css=css, title="ZenCtrl Inpainting") as demo:
159
  )
160
 
161
  # ---------- Buttons & interactions --------------------------
 
 
 
 
 
162
  run_btn.click(
163
  process_image_and_text,
164
  inputs=[subj_img, ref_img, promptbox, gr.State(False), gr.State("")],
165
- outputs=[gallery, raw_state]
166
  )
167
  bg_btn.click(_gen_bg, inputs=[bgprompt], outputs=[bg_img])
168
 
 
78
  try:
79
  blended_bytes = base64.b64decode(data["blended"])
80
  raw_img = Image.open(BytesIO(blended_bytes)).convert("RGB")
81
+ return raw_img, raw_img
82
  except Exception:
83
  raise gr.Error("Failed to decode 'blended' image from Baseten response.")
84
  else:
 
128
  bg_btn = gr.Button("Generate BG")
129
 
130
  with gr.Column(scale=2):
131
+ output_img = gr.Image(label="Output Image")
132
  bg_img = gr.Image(label="Background", visible=True)
133
 
134
  # ---------- Example wrapper ---------------------------------
 
159
  )
160
 
161
  # ---------- Buttons & interactions --------------------------
162
+ # run_btn.click(
163
+ # process_image_and_text,
164
+ # inputs=[subj_img, ref_img, promptbox, gr.State(False), gr.State("")],
165
+ # outputs=[gallery, raw_state]
166
+ # )
167
  run_btn.click(
168
  process_image_and_text,
169
  inputs=[subj_img, ref_img, promptbox, gr.State(False), gr.State("")],
170
+ outputs=[output_img, raw_state]
171
  )
172
  bg_btn.click(_gen_bg, inputs=[bgprompt], outputs=[bg_img])
173