fariyan's picture
Update app.py
2368dc1
raw
history blame contribute delete
No virus
598 Bytes
import gradio as gr
import rembg
from rembg import remove
from PIL import Image
import io
def remove_background(image):
input_data = image.read()
output_data = remove(input_data)
output_image = Image.open(io.BytesIO(output_data)).convert("RGBA")
return output_image
image_input = gr.inputs.Image()
image_output = gr.outputs.Image()
title = "Remove Background from Image"
description = "Upload an image and remove its background using the rembg library."
gr.Interface(fn=remove_background, inputs=image_input, outputs=image_output, title=title, description=description).launch()