File size: 590 Bytes
34018e0
 
 
32644bf
34018e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ba2c8ab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from transparent_background import Remover

remover = Remover(mode='base-nightly')


def run(inp_image, sod_type):
    return remover.process(inp_image.convert("RGB"), type=sod_type)


with gr.Blocks() as demo:
    with gr.Row():
        inp_image = gr.Image(type="pil")
        res_image = gr.Image(type="pil")
    sod_type = gr.Radio(["rgba", "map", "green", "white", "blur", "overlay"], value="rgba")
    submit_btn = gr.Button(value="Submit")
    submit_btn.click(run, inputs=[inp_image, sod_type], outputs=[res_image])

if __name__ == "__main__":
    demo.launch()