amirgame197's picture
Update app.py
12783b0 verified
raw
history blame
489 Bytes
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()