Spaces:
Sleeping
Sleeping
File size: 689 Bytes
1a39fb2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import gradio as gd
from transformers import pipeline
from PIL import Image
# Streamlit
def remove_background(img):
pipeline_model = pipeline("image-segmentation", model="briaai/RMBG-1.4", trust_remote_code=True)
mask_pillow = pipeline_model(img, return_mask=True)
image_pillow = pipeline_model(img)
return image_pillow
# remove_background("img/image2.jpg")
app = gd.Interface(
title="Remove Background na Imagem",
description="Faça upload da imagem para remover o background",
fn=remove_background,
inputs=gd.components.Image(type="pil"),
outputs=gd.components.Image(type="pil", format="png")
)
if __name__ == "__main__":
app.launch(share=True) |