Spaces:
Running
Running
Add application file
Browse files- app.py +21 -0
- requirements.txt +1 -0
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transparent_background import Remover
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
@spaces.GPU
|
| 6 |
+
def remove_background(image):
|
| 7 |
+
remover = Remover()
|
| 8 |
+
output = remover.process(image)
|
| 9 |
+
return output
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
iface = gr.Interface(
|
| 13 |
+
fn=remove_background,
|
| 14 |
+
inputs=gr.inputs.Image(),
|
| 15 |
+
outputs=gr.outputs.Image(),
|
| 16 |
+
title="Background Remover",
|
| 17 |
+
description="Upload an image and get the background removed.",
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
if __name__ == "__main__":
|
| 21 |
+
iface.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
transparent-background
|