Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -110,6 +110,11 @@ def tiled_flux_img2img(pipe, prompt, image, strength, steps, guidance, generator
|
|
110 |
continue
|
111 |
tile = image.crop((x, y, x + tile_w, y + tile_h))
|
112 |
|
|
|
|
|
|
|
|
|
|
|
113 |
# Run Flux on tile
|
114 |
gen_tile = pipe(
|
115 |
prompt=prompt,
|
@@ -117,14 +122,13 @@ def tiled_flux_img2img(pipe, prompt, image, strength, steps, guidance, generator
|
|
117 |
strength=strength,
|
118 |
num_inference_steps=steps,
|
119 |
guidance_scale=guidance,
|
120 |
-
height=
|
121 |
-
width=
|
122 |
generator=generator,
|
123 |
).images[0]
|
124 |
|
125 |
-
# Resize gen_tile back to original tile dimensions
|
126 |
-
|
127 |
-
gen_tile = gen_tile.resize((tile_w, tile_h), resample=Image.LANCZOS)
|
128 |
|
129 |
# Paste with blending if overlap
|
130 |
if overlap > 0:
|
|
|
110 |
continue
|
111 |
tile = image.crop((x, y, x + tile_w, y + tile_h))
|
112 |
|
113 |
+
# Force tile to div by 16
|
114 |
+
new_tile_w = make_divisible_by_16(tile_w)
|
115 |
+
new_tile_h = make_divisible_by_16(tile_h)
|
116 |
+
tile = tile.resize((new_tile_w, new_tile_h), resample=Image.LANCZOS)
|
117 |
+
|
118 |
# Run Flux on tile
|
119 |
gen_tile = pipe(
|
120 |
prompt=prompt,
|
|
|
122 |
strength=strength,
|
123 |
num_inference_steps=steps,
|
124 |
guidance_scale=guidance,
|
125 |
+
height=new_tile_h,
|
126 |
+
width=new_tile_w,
|
127 |
generator=generator,
|
128 |
).images[0]
|
129 |
|
130 |
+
# Resize gen_tile back to original tile dimensions
|
131 |
+
gen_tile = gen_tile.resize((tile_w, tile_h), resample=Image.LANCZOS)
|
|
|
132 |
|
133 |
# Paste with blending if overlap
|
134 |
if overlap > 0:
|