Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,22 +5,16 @@ import io
|
|
| 5 |
|
| 6 |
def remove_bg(image):
|
| 7 |
img_bytes = io.BytesIO()
|
| 8 |
-
image.save(img_bytes, format=
|
| 9 |
-
|
| 10 |
-
return Image.open(io.BytesIO(
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
with gr.Row():
|
| 20 |
-
clear_btn = gr.ClearButton(input_img)
|
| 21 |
-
process_btn = gr.Button("Remove Background")
|
| 22 |
-
|
| 23 |
-
process_btn.click(fn=remove_bg, inputs=input_img, outputs=output_img)
|
| 24 |
|
| 25 |
demo.launch()
|
| 26 |
-
print("App running - built by Karthik")
|
|
|
|
| 5 |
|
| 6 |
def remove_bg(image):
|
| 7 |
img_bytes = io.BytesIO()
|
| 8 |
+
image.save(img_bytes, format='PNG')
|
| 9 |
+
result = remove(img_bytes.getvalue())
|
| 10 |
+
return Image.open(io.BytesIO(result))
|
| 11 |
|
| 12 |
+
demo = gr.Interface(
|
| 13 |
+
fn=remove_bg,
|
| 14 |
+
inputs=gr.Image(type="pil", label="🖼️ Upload an Image"),
|
| 15 |
+
outputs=gr.Image(label="✨ Background Removed"),
|
| 16 |
+
title="🎨 AI Background Remover",
|
| 17 |
+
description="Upload an image and instantly remove the background using AI",
|
| 18 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
demo.launch()
|
|
|