fast-bg-rem / app.py
trysem's picture
Update app.py
7651757
import gradio as gr
from rembg import remove as rm
def rem_bg(input):
if input !=None:
#pass
result=rm(input)
out1 = gr.Pil.update(value=result,visible=True)
out2 = gr.Accordion.update(label="Original Image",open=False)
else:
out1 = None
out2 = None
pass
return out1, out2
with gr.Blocks(css="footer {visibility:hidden}") as myface:
gr.Markdown("""<center><h1>Fast Background Remover</h1><center>""")
with gr.Row():
gr.Column()
with gr.Column():
with gr.Accordion("Details",open=False):
gr.Markdown("""<center><h3>Drop your image in the box, and the background will be removed.</h3><center>""")
with gr.Accordion(label="Input Image",open=True) as og:
in_win=gr.Pil(label="Input", interactive=True, batch=True, max_batch_size=20)
out_win=gr.Pil(label="Output",visible=False)
gr.Column()
in_win.change(rem_bg,in_win,[out_win,og])
myface.queue(concurrency_count=120)
myface.launch()