import gradio as gr | |
import cv2 | |
import numpy as np | |
from PIL import Image | |
from transparent_background import Remover | |
# Load model | |
remover = Remover(mode='fast') # custom setting | |
# Usage for image | |
def doo(image): | |
img = Image.fromarray(image).convert('RGB') # read image | |
out = remover.process(img) # default setting - transparent background | |
out.save('output.png') # save result | |
return out | |
iface = gr.Interface(fn=doo, inputs="image", outputs="image") | |
iface.launch() |