atatakun commited on
Commit
307df25
1 Parent(s): d4d116c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -228,12 +228,15 @@ model_inpaint = None
228
  def inpaint(image, invert):
229
  # image = resize_image(img, res)
230
  # color = HWC3(image["image"])
231
- # if(invert):
 
232
  # alpha = image["mask"][:, :, 0:1]
233
- # else:
 
234
  # alpha = 255 - image["mask"][:, :, 0:1]
 
235
  # result = np.concatenate([color, alpha], axis=2)
236
- result = image["mask"]
237
  return [result]
238
 
239
  block = gr.Blocks().queue()
@@ -262,7 +265,6 @@ with block:
262
  with gr.Row():
263
  with gr.Column():
264
  input_image = gr.ImageMask(sources="upload", type="numpy", height="auto")
265
- input_preview=gr.Image()
266
  # input_image = gr.ImageEditor(sources="upload", type="numpy", height="auto", layers="False", brush=gr.Brush(colors=["#000000"]))
267
  # input_image = gr.Image(source='upload', type="numpy", tool="sketch", height=512)
268
  # resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
 
228
  def inpaint(image, invert):
229
  # image = resize_image(img, res)
230
  # color = HWC3(image["image"])
231
+ color = HWC3(image["composite"])
232
+ if(invert):
233
  # alpha = image["mask"][:, :, 0:1]
234
+ alpha = image["background"][:, :, 0:1]
235
+ else:
236
  # alpha = 255 - image["mask"][:, :, 0:1]
237
+ alpha = 255 - image["background"][:, :, 0:1]
238
  # result = np.concatenate([color, alpha], axis=2)
239
+ result = np.concatenate(color)
240
  return [result]
241
 
242
  block = gr.Blocks().queue()
 
265
  with gr.Row():
266
  with gr.Column():
267
  input_image = gr.ImageMask(sources="upload", type="numpy", height="auto")
 
268
  # input_image = gr.ImageEditor(sources="upload", type="numpy", height="auto", layers="False", brush=gr.Brush(colors=["#000000"]))
269
  # input_image = gr.Image(source='upload', type="numpy", tool="sketch", height=512)
270
  # resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)