Update app.py
Browse files
app.py
CHANGED
@@ -236,10 +236,11 @@ with gr.Blocks(theme='pikto/theme@>=0.0.1,<0.0.3') as pan:
|
|
236 |
matting_state = gr.State(value=(0, 0, 0))
|
237 |
gr.HTML("<center><h1>Remove Background Tool</h1></center>")
|
238 |
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
|
|
243 |
with gr.Row():
|
244 |
chk_include_matting = gr.Checkbox(label="Matting", value=False)
|
245 |
chk_smoot_mask = gr.Checkbox(label="Smoot Mask", value=False)
|
@@ -253,37 +254,15 @@ with gr.Blocks(theme='pikto/theme@>=0.0.1,<0.0.3') as pan:
|
|
253 |
chk_change_color = gr.Checkbox(label="Change background color", value=False)
|
254 |
pkr_color = gr.ColorPicker(label="Pick a new color", visible=False)
|
255 |
chk_dominant = gr.Checkbox(label="Use dominant color", value=False, visible=False)
|
256 |
-
|
257 |
-
with gr.Column():
|
258 |
-
output_img = gr.Image(type="pil", label="Image Result")
|
259 |
-
mask_img = gr.Image(type="pil", label="Image Mask", visible=False)
|
260 |
-
gr.ClearButton(components=[input_img, output_img, mask_img])
|
261 |
-
|
262 |
-
chk_include_matting.change(change_include_matting, inputs=[chk_include_matting],
|
263 |
-
outputs=[slider_matting, matting_state,
|
264 |
-
slr_fg_threshold, slr_bg_threshold, slr_erode_size])
|
265 |
-
|
266 |
-
slr_fg_threshold.change(change_foreground_threshold, inputs=[slr_fg_threshold, matting_state],
|
267 |
-
outputs=[matting_state])
|
268 |
-
|
269 |
-
slr_bg_threshold.change(change_background_threshold, inputs=[slr_bg_threshold, matting_state],
|
270 |
-
outputs=[matting_state])
|
271 |
|
272 |
-
|
273 |
-
|
|
|
|
|
274 |
|
275 |
-
chk_show_mask.change(change_show_mask, inputs=[chk_show_mask], outputs=[mask_img])
|
276 |
|
277 |
-
|
278 |
-
outputs=[pkr_color, chk_dominant])
|
279 |
-
|
280 |
-
pkr_color.change(change_picker_color, inputs=[pkr_color, chk_dominant], outputs=[color_state])
|
281 |
-
|
282 |
-
chk_dominant.change(set_dominant_color, inputs=[chk_dominant], outputs=[color_state, pkr_color])
|
283 |
-
|
284 |
-
run_btn.click(predict, inputs=[input_img, drp_models, chk_smoot_mask, matting_state, color_state],
|
285 |
-
outputs=[output_img, mask_img])
|
286 |
-
|
287 |
# text_input = gr.Textbox() ## Diffuser
|
288 |
# image_output = gr.Image()
|
289 |
# image_button = gr.Button("Flip")
|
|
|
236 |
matting_state = gr.State(value=(0, 0, 0))
|
237 |
gr.HTML("<center><h1>Remove Background Tool</h1></center>")
|
238 |
|
239 |
+
with gr.Row(equal_height=False):
|
240 |
+
with gr.Column():
|
241 |
+
input_img = gr.Image(type="pil", label="Input image")
|
242 |
+
drp_models = gr.Dropdown(choices=model_choices, label="Model Segment", value="TracerUniversalB7")
|
243 |
+
|
244 |
with gr.Row():
|
245 |
chk_include_matting = gr.Checkbox(label="Matting", value=False)
|
246 |
chk_smoot_mask = gr.Checkbox(label="Smoot Mask", value=False)
|
|
|
254 |
chk_change_color = gr.Checkbox(label="Change background color", value=False)
|
255 |
pkr_color = gr.ColorPicker(label="Pick a new color", visible=False)
|
256 |
chk_dominant = gr.Checkbox(label="Use dominant color", value=False, visible=False)
|
257 |
+
run_btn = gr.Button(value="Remove background", variant="primary")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
|
259 |
+
with gr.Column():
|
260 |
+
output_img = gr.Image(type="pil", label="Image Result")
|
261 |
+
mask_img = gr.Image(type="pil", label="Image Mask", visible=False)
|
262 |
+
gr.ClearButton(components=[input_img, output_img, mask_img])
|
263 |
|
|
|
264 |
|
265 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
# text_input = gr.Textbox() ## Diffuser
|
267 |
# image_output = gr.Image()
|
268 |
# image_button = gr.Button("Flip")
|