Spaces:
Runtime error
Runtime error
max
commited on
Commit
·
de4aa1c
1
Parent(s):
85d241c
example for rgba input
Browse files
app.py
CHANGED
|
@@ -281,7 +281,7 @@ class Predictor:
|
|
| 281 |
1-(np.array(m) / 255)
|
| 282 |
)
|
| 283 |
minpainted = mask_to_alpha(inpainted, m)
|
| 284 |
-
return
|
| 285 |
|
| 286 |
|
| 287 |
predictor = Predictor()
|
|
@@ -302,7 +302,8 @@ def _outpaint(img, tosize, border, seed, size, model):
|
|
| 302 |
# %%
|
| 303 |
|
| 304 |
|
| 305 |
-
searchimage = gc.Image(shape=(224, 224), label="image",
|
|
|
|
| 306 |
to_size = gc.Slider(1, 1920, 512, step=1, label='output size')
|
| 307 |
border = gc.Slider(
|
| 308 |
1, 50, 0, step=1, label='border to crop from the image before outpainting')
|
|
@@ -310,7 +311,8 @@ seed = gc.Slider(1, 65536, 10, step=1, label='seed')
|
|
| 310 |
size = gc.Slider(0, 1, .5, step=0.01,
|
| 311 |
label='scale of the image before outpainting')
|
| 312 |
|
| 313 |
-
out = gc.Image(label="primed image with alpha channel",
|
|
|
|
| 314 |
outwithoutalpha = gc.Image(
|
| 315 |
label="primed image without alpha channel", type='pil')
|
| 316 |
mask = gc.Image(label="outpainting mask", type='pil')
|
|
@@ -333,9 +335,9 @@ gr.Interface(
|
|
| 333 |
[outwithoutalpha, out, mask],
|
| 334 |
title=f"MAT Primer for Stable Diffusion\n\nbased on MAT: Mask-Aware Transformer for Large Hole Image Inpainting\n\n{maturl}",
|
| 335 |
description=f"""<html>
|
| 336 |
-
create
|
| 337 |
-
|
| 338 |
-
<img src='file/op.gif' />
|
| 339 |
</html>""",
|
| 340 |
analytics_enabled=False,
|
| 341 |
allow_flagging='never',
|
|
|
|
| 281 |
1-(np.array(m) / 255)
|
| 282 |
)
|
| 283 |
minpainted = mask_to_alpha(inpainted, m)
|
| 284 |
+
return inpainted, minpainted, ImageOps.invert(m)
|
| 285 |
|
| 286 |
|
| 287 |
predictor = Predictor()
|
|
|
|
| 302 |
# %%
|
| 303 |
|
| 304 |
|
| 305 |
+
searchimage = gc.Image(shape=(224, 224), label="image",
|
| 306 |
+
type='pil', image_mode='RGBA')
|
| 307 |
to_size = gc.Slider(1, 1920, 512, step=1, label='output size')
|
| 308 |
border = gc.Slider(
|
| 309 |
1, 50, 0, step=1, label='border to crop from the image before outpainting')
|
|
|
|
| 311 |
size = gc.Slider(0, 1, .5, step=0.01,
|
| 312 |
label='scale of the image before outpainting')
|
| 313 |
|
| 314 |
+
out = gc.Image(label="primed image with alpha channel",
|
| 315 |
+
type='pil', image_mode='RGBA')
|
| 316 |
outwithoutalpha = gc.Image(
|
| 317 |
label="primed image without alpha channel", type='pil')
|
| 318 |
mask = gc.Image(label="outpainting mask", type='pil')
|
|
|
|
| 335 |
[outwithoutalpha, out, mask],
|
| 336 |
title=f"MAT Primer for Stable Diffusion\n\nbased on MAT: Mask-Aware Transformer for Large Hole Image Inpainting\n\n{maturl}",
|
| 337 |
description=f"""<html>
|
| 338 |
+
create a primer for use in stable diffusion outpainting<br>
|
| 339 |
+
examples with strength 0.5
|
| 340 |
+
<img src='file/op.gif' /> <img src='file/rgba.gif' />
|
| 341 |
</html>""",
|
| 342 |
analytics_enabled=False,
|
| 343 |
allow_flagging='never',
|
rgba.gif
ADDED
|
Git LFS Details
|