Upload app.py
Browse files
app.py
CHANGED
@@ -214,8 +214,8 @@ def color_shuffler(img, res):
|
|
214 |
model_inpaint = None
|
215 |
|
216 |
|
217 |
-
def inpaint(
|
218 |
-
|
219 |
color = HWC3(image["image"])
|
220 |
if(invert):
|
221 |
alpha = image["mask"][:, :, 0:1]
|
@@ -246,13 +246,13 @@ with block:
|
|
246 |
with gr.Row():
|
247 |
with gr.Column():
|
248 |
input_image = gr.Image(source='upload', type="numpy", tool="sketch", height=512)
|
249 |
-
|
250 |
invert = gr.Checkbox(label='Mask Invert', value=False)
|
251 |
run_button = gr.Button(label="Run")
|
252 |
with gr.Column():
|
253 |
gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
|
254 |
# run_button.click(fn=inpaint, inputs=[input_image, resolution], outputs=[gallery])
|
255 |
-
run_button.click(fn=inpaint, inputs=[input_image, invert], outputs=[gallery])
|
256 |
|
257 |
gr.Markdown("<hr>")
|
258 |
with gr.Row():
|
|
|
214 |
model_inpaint = None
|
215 |
|
216 |
|
217 |
+
def inpaint(img, invert, res):
|
218 |
+
image = resize_image(img, res)
|
219 |
color = HWC3(image["image"])
|
220 |
if(invert):
|
221 |
alpha = image["mask"][:, :, 0:1]
|
|
|
246 |
with gr.Row():
|
247 |
with gr.Column():
|
248 |
input_image = gr.Image(source='upload', type="numpy", tool="sketch", height=512)
|
249 |
+
resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
|
250 |
invert = gr.Checkbox(label='Mask Invert', value=False)
|
251 |
run_button = gr.Button(label="Run")
|
252 |
with gr.Column():
|
253 |
gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
|
254 |
# run_button.click(fn=inpaint, inputs=[input_image, resolution], outputs=[gallery])
|
255 |
+
run_button.click(fn=inpaint, inputs=[input_image, invert, res], outputs=[gallery])
|
256 |
|
257 |
gr.Markdown("<hr>")
|
258 |
with gr.Row():
|