Spaces:
Sleeping
Sleeping
File size: 579 Bytes
a55dfd9 2803aaa a55dfd9 2803aaa a55dfd9 2803aaa a55dfd9 2803aaa |
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
from rembg import remove
from PIL import Image
def remove_bg(image_path):
if image_path is None:
return None
image = Image.open(image_path) # ✅ Open the image from the file path
output = remove(image)
return output
# Creating Gradio interface
iface = gr.Interface(
fn=remove_bg,
inputs=gr.Image(type="filepath"), # ✅ Make sure Gradio passes the file path
outputs=gr.Image(type="pil"),
title="AI Background Remover",
description="Upload an image and remove its background automatically!",
)
iface.launch()
|