atatakun commited on
Commit
8cd6c25
·
verified ·
1 Parent(s): 5b3bc06

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -227,12 +227,13 @@ model_inpaint = None
227
 
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
  return [result]
237
 
238
  block = gr.Blocks().queue()
@@ -260,8 +261,7 @@ with block:
260
  gr.Markdown("## Inpaint \n<p>Mochi Diffusion v4.1で使えるようになりました")
261
  with gr.Row():
262
  with gr.Column():
263
- input_image = gr.Image(label="Input Image", type="numpy", tools="sketch", height="auto")
264
- # input_image = gr.ImageMask(sources="upload", type="numpy", height="auto")
265
  # input_image = gr.ImageEditor(sources="upload", type="numpy", height="auto", layers="False", brush=gr.Brush(colors=["#000000"]))
266
  # input_image = gr.Image(source='upload', type="numpy", tool="sketch", height=512)
267
  # resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
 
227
 
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
237
  return [result]
238
 
239
  block = gr.Blocks().queue()
 
261
  gr.Markdown("## Inpaint \n<p>Mochi Diffusion v4.1で使えるようになりました")
262
  with gr.Row():
263
  with gr.Column():
264
+ input_image = gr.ImageMask(sources="upload", type="numpy", height="auto")
 
265
  # input_image = gr.ImageEditor(sources="upload", type="numpy", height="auto", layers="False", brush=gr.Brush(colors=["#000000"]))
266
  # input_image = gr.Image(source='upload', type="numpy", tool="sketch", height=512)
267
  # resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)