File size: 489 Bytes
de2aa9b ba4d1a9 de2aa9b ba4d1a9 b8b6392 ba4d1a9 b8b6392 de2aa9b ba4d1a9 de2aa9b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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() |