24yearsold commited on
Commit
b6b5ee7
·
verified ·
1 Parent(s): 1e6a089

cap resolution at 1280, 120s timeout, recommend 768 for free tier

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -91,14 +91,14 @@ def _collect_layer_gallery(saved_dir):
91
  return gallery
92
 
93
 
94
- @spaces.GPU(duration=60)
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.")
99
 
100
  # Snap to nearest multiple of 64 for clean latent dimensions
101
- resolution = max(64, min(resolution, 1536))
102
  resolution = round(resolution / 64) * 64
103
  _log(f"Resolution: {resolution}, Seed: {seed}, Image: {image.size}")
104
 
@@ -158,8 +158,9 @@ with gr.Blocks(title="See-through: Layer Decomposition") as demo:
158
  "Upload an anime character illustration to decompose it into "
159
  "fully-inpainted semantic layers with depth ordering, "
160
  "exported as a layered PSD file.\n\n"
161
- "**Note:** This demo caps resolution at 1536 due to GPU constraints. "
162
- "For higher resolutions, clone the [full repo](https://github.com/shitagaki-lab/see-through) "
 
163
  "and run `inference_psd.py` locally.\n\n"
164
  "**Disclaimer:** This demo uses a newer model checkpoint and "
165
  "may not fully reproduce identical results reported in the paper."
@@ -168,9 +169,9 @@ with gr.Blocks(title="See-through: Layer Decomposition") as demo:
168
  with gr.Column(scale=1):
169
  input_image = gr.Image(type="pil", label="Upload image (non-square images will be padded)")
170
  resolution = gr.Slider(
171
- minimum=768, maximum=1536, value=768, step=64,
172
  label="Resolution",
173
- info="Higher = finer details but slower. 1280 is the default trained resolution. For resolutions above 1536, please use the full pipeline locally.",
174
  )
175
  seed = gr.Slider(minimum=0, maximum=9999, value=42, step=1, label="Seed")
176
  run_btn = gr.Button("Run", variant="primary")
 
91
  return gallery
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.")
99
 
100
  # Snap to nearest multiple of 64 for clean latent dimensions
101
+ resolution = max(64, min(resolution, 1280))
102
  resolution = round(resolution / 64) * 64
103
  _log(f"Resolution: {resolution}, Seed: {seed}, Image: {image.size}")
104
 
 
158
  "Upload an anime character illustration to decompose it into "
159
  "fully-inpainted semantic layers with depth ordering, "
160
  "exported as a layered PSD file.\n\n"
161
+ "**Note:** 768 resolution is recommended for ZeroGPU free tier. "
162
+ "Higher resolutions may timeout or exhaust your daily quota. "
163
+ "For best quality, clone the [full repo](https://github.com/shitagaki-lab/see-through) "
164
  "and run `inference_psd.py` locally.\n\n"
165
  "**Disclaimer:** This demo uses a newer model checkpoint and "
166
  "may not fully reproduce identical results reported in the paper."
 
169
  with gr.Column(scale=1):
170
  input_image = gr.Image(type="pil", label="Upload image (non-square images will be padded)")
171
  resolution = gr.Slider(
172
+ minimum=768, maximum=1280, value=768, step=64,
173
  label="Resolution",
174
+ info="768 recommended for ZeroGPU free tier. Higher resolutions may timeout or use up your daily quota quickly.",
175
  )
176
  seed = gr.Slider(minimum=0, maximum=9999, value=42, step=1, label="Seed")
177
  run_btn = gr.Button("Run", variant="primary")