import gradio as gr
from rembg import remove as rm

def rem_bg(input):
    if input !=None:
        out1=rm(input)
    else:
        out1 = None
        pass
    return out1

with gr.Blocks() as myface:
    with gr.Row():
        gr.Column()
        with gr.Column():
            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)
myface.queue(concurrency_count=120)
myface.launch()