Spaces:
Build error
Build error
File size: 666 Bytes
206cb2f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import gradio as gd
from transformers import pipeline
from PIL import Image
def remove_bg(image):
pipe = pipeline(
"image-segmentation", model="briaai/RMBG-1.4", trust_remote_code=True
)
pillow_mask = pipe(image, return_mask=True) # outputs a pillow mask
pillow_image = pipe(image)
return pillow_image
# remove_bg("image\IMG_0637.jpg")
app = gd.Interface(
title="REMOVE BACKGROUND IMAGE",
description="Faça upload da imagem para remover o bg",
fn=remove_bg,
inputs=gd.components.Image(type="pil"),
outputs=gd.components.Image(type="pil", format="png"),
)
if __name__ == "__main__":
app.launch(share=True)
|