Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from rembg import remove
|
| 3 |
+
|
| 4 |
+
def process_image(input_img):
|
| 5 |
+
"""Processes an image by removing its background and resizing it."""
|
| 6 |
+
img = remove(input_img)
|
| 7 |
+
return img
|
| 8 |
+
|
| 9 |
+
with gr.Blocks() as demo:
|
| 10 |
+
gr.Interface(
|
| 11 |
+
fn=process_image,
|
| 12 |
+
inputs = [gr.Image(label="Input Image", interactive=True)],
|
| 13 |
+
outputs = gr.Image(label="Upscaled Image"),
|
| 14 |
+
examples=[["images/sample1.png"]],
|
| 15 |
+
title="📸 Image Background Remover")
|
| 16 |
+
|
| 17 |
+
if __name__ == "__main__":
|
| 18 |
+
demo.launch()
|