Spaces:
Build error
Build error
Update app.py
Browse files140 unmodified lines1411421431441451461471481491501511521531541551565 unmodified lines162163164165166167168169170140 unmodified linesbg_img = gr.Image(label="Background", visible=True)# ---------- Example wrapper ---------------------------------def _run_example(subj_path, bg_path, prompt):subj = Image.open(subj_path)bg = Image.open(bg_path)# Automatically infer output path from naming convention# Replace `examples/sofa1.png` → `examples/sofa1_out.png`output_path = subj_path.replace(".png", "_out.png")result = Image.open(output_path)return result, bg # or just `return result` if not showing background# ---------- Examples ----------------------------------------gr.Examples(5 unmodified lines["examples/office_chair.png", "examples/office_chair_bg.png", "office chair", "examples/office_chair_out.png"],["examples/car.png", "examples/car_bg.png", "car on the road", "examples/car_out.png"],],inputs=[subj_img, ref_img, promptbox, output_img],#outputs=[output_img],#fn=_run_example,label="Visual Presets: Subject · Background · Prompt · Output",examples_per_page="all")140 unmodified lines1411421431441451461471485 unmodified lines154155156157158159160161162140 unmodified linesbg_img = gr.Image(label="Background", visible=True)# ---------- Example wrapper ---------------------------------def _load_and_show(subj_path, bg_path, prompt):return Image.open(subj_path), Image.open(bg_path), prompt, Image.open(subj_path.replace(".png", "_out.png"))# ---------- Examples ----------------------------------------gr.Examples(5 unmodified lines["examples/office_chair.png", "examples/office_chair_bg.png", "office chair", "examples/office_chair_out.png"],["examples/car.png", "examples/car_bg.png", "car on the road", "examples/car_out.png"],],inputs=[subj_img, ref_img, promptbox],outputs=[output_img],fn=_load_and_show,label="Visual Presets: Subject · Background · Prompt · Output",examples_per_page="all")
app.py+5-13