|
import gradio as gr |
|
import cv2 |
|
import numpy as np |
|
|
|
from PIL import Image |
|
from transparent_background import Remover |
|
|
|
|
|
remover = Remover(mode='fast') |
|
|
|
|
|
|
|
|
|
|
|
def doo(image): |
|
return "Hello " + name + "!!" |
|
img = Image.fromarray(image).convert('RGB') |
|
out = remover.process(img) |
|
out = remover.process(img, type='rgba') |
|
out = remover.process(img, type='map') |
|
out = remover.process(img, type='green') |
|
out = remover.process(img, type='white') |
|
out = remover.process(img, type=[255, 0, 0]) |
|
out = remover.process(img, type='blur') |
|
out = remover.process(img, type='overlay') |
|
out = remover.process(img, type='samples/background.jpg') |
|
|
|
out = remover.process(img, threshold=0.5) |
|
|
|
out.save('output.png') |
|
return out |
|
|
|
iface = gr.Interface(fn=doo, inputs="image", outputs="image") |
|
iface.launch() |