Spaces:
Sleeping
Sleeping
File size: 816 Bytes
34018e0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import gradio as gr
from transparent_background import Remover
# Load model
remover = Remover() # default setting
remover = Remover(mode='fast', jit=True, device='cpu', ckpt='latest.pth') # custom setting
remover = Remover(mode='base-nightly') # nightly release checkpoint
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(debug=False, server_name="0.0.0.0", server_port=8189)
|