Spaces:
Running on Zero
Running on Zero
add tblr_split checkbox to UI
Browse filesAddresses user request in HF Space discussion #3 — left and right
limbs were glued together in the default output. Checkbox defaults
to off to preserve existing behavior.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
app.py
CHANGED
|
@@ -92,7 +92,7 @@ def _collect_layer_gallery(saved_dir):
|
|
| 92 |
|
| 93 |
|
| 94 |
@spaces.GPU(duration=120)
|
| 95 |
-
def inference(image: Image.Image, resolution: int = 768, seed: int = 42):
|
| 96 |
t_start = time.time()
|
| 97 |
if image is None:
|
| 98 |
raise gr.Error("Please upload an image.")
|
|
@@ -133,7 +133,7 @@ def inference(image: Image.Image, resolution: int = 768, seed: int = 42):
|
|
| 133 |
|
| 134 |
t0 = time.time()
|
| 135 |
_log("Running PSD assembly...")
|
| 136 |
-
further_extr(saved, rotate=False, save_to_psd=True, tblr_split=
|
| 137 |
_log(f"PSD assembly done ({time.time() - t0:.1f}s)")
|
| 138 |
|
| 139 |
psd_path = saved + ".psd"
|
|
@@ -176,6 +176,11 @@ with gr.Blocks(title="See-through: Layer Decomposition") as demo:
|
|
| 176 |
info="768 recommended for ZeroGPU free tier. Higher resolutions may timeout or use up your daily quota quickly.",
|
| 177 |
)
|
| 178 |
seed = gr.Slider(minimum=0, maximum=9999, value=42, step=1, label="Seed")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
run_btn = gr.Button("Run", variant="primary")
|
| 180 |
with gr.Column(scale=2):
|
| 181 |
psd_output = gr.File(label="Download layered PSD")
|
|
@@ -183,12 +188,12 @@ with gr.Blocks(title="See-through: Layer Decomposition") as demo:
|
|
| 183 |
|
| 184 |
run_btn.click(
|
| 185 |
fn=inference,
|
| 186 |
-
inputs=[input_image, resolution, seed],
|
| 187 |
outputs=[psd_output, gallery_output],
|
| 188 |
)
|
| 189 |
gr.Examples(
|
| 190 |
-
examples=[["common/assets/test_image.png", 768, 42]],
|
| 191 |
-
inputs=[input_image, resolution, seed],
|
| 192 |
)
|
| 193 |
|
| 194 |
if __name__ == "__main__":
|
|
|
|
| 92 |
|
| 93 |
|
| 94 |
@spaces.GPU(duration=120)
|
| 95 |
+
def inference(image: Image.Image, resolution: int = 768, seed: int = 42, tblr_split: bool = False):
|
| 96 |
t_start = time.time()
|
| 97 |
if image is None:
|
| 98 |
raise gr.Error("Please upload an image.")
|
|
|
|
| 133 |
|
| 134 |
t0 = time.time()
|
| 135 |
_log("Running PSD assembly...")
|
| 136 |
+
further_extr(saved, rotate=False, save_to_psd=True, tblr_split=tblr_split)
|
| 137 |
_log(f"PSD assembly done ({time.time() - t0:.1f}s)")
|
| 138 |
|
| 139 |
psd_path = saved + ".psd"
|
|
|
|
| 176 |
info="768 recommended for ZeroGPU free tier. Higher resolutions may timeout or use up your daily quota quickly.",
|
| 177 |
)
|
| 178 |
seed = gr.Slider(minimum=0, maximum=9999, value=42, step=1, label="Seed")
|
| 179 |
+
tblr_split = gr.Checkbox(
|
| 180 |
+
value=False,
|
| 181 |
+
label="Split left/right arms & legs",
|
| 182 |
+
info="Separate left and right limbs into individual layers. Useful if the default output glues them together.",
|
| 183 |
+
)
|
| 184 |
run_btn = gr.Button("Run", variant="primary")
|
| 185 |
with gr.Column(scale=2):
|
| 186 |
psd_output = gr.File(label="Download layered PSD")
|
|
|
|
| 188 |
|
| 189 |
run_btn.click(
|
| 190 |
fn=inference,
|
| 191 |
+
inputs=[input_image, resolution, seed, tblr_split],
|
| 192 |
outputs=[psd_output, gallery_output],
|
| 193 |
)
|
| 194 |
gr.Examples(
|
| 195 |
+
examples=[["common/assets/test_image.png", 768, 42, False]],
|
| 196 |
+
inputs=[input_image, resolution, seed, tblr_split],
|
| 197 |
)
|
| 198 |
|
| 199 |
if __name__ == "__main__":
|