Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
from transparent_background import Remover
|
3 |
from PIL import Image
|
@@ -14,37 +15,11 @@ def remove_background(image):
|
|
14 |
raise TypeError("Unsupported image type")
|
15 |
return output
|
16 |
|
17 |
-
css = """
|
18 |
-
body {
|
19 |
-
background-color: #f5f5f5;
|
20 |
-
font-family: Arial, sans-serif;
|
21 |
-
}
|
22 |
-
.input_image, .output_image {
|
23 |
-
border-radius: 10px;
|
24 |
-
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
|
25 |
-
}
|
26 |
-
.gr-button {
|
27 |
-
background-color: #4CAF50;
|
28 |
-
color: white;
|
29 |
-
border: none;
|
30 |
-
padding: 10px 20px;
|
31 |
-
text-align: center;
|
32 |
-
font-size: 16px;
|
33 |
-
cursor: pointer;
|
34 |
-
border-radius: 5px;
|
35 |
-
margin: 4px 2px;
|
36 |
-
}
|
37 |
-
.gr-button:hover {
|
38 |
-
background-color: #45a049;
|
39 |
-
}
|
40 |
-
"""
|
41 |
-
|
42 |
iface = gr.Interface(
|
43 |
fn=remove_background,
|
44 |
-
inputs=gr.Image(label="Upload Image"
|
45 |
-
outputs=gr.Image(label="Output Image"
|
46 |
-
live=True,
|
47 |
-
css=css
|
48 |
)
|
49 |
|
50 |
-
|
|
|
|
1 |
+
import spaces
|
2 |
import gradio as gr
|
3 |
from transparent_background import Remover
|
4 |
from PIL import Image
|
|
|
15 |
raise TypeError("Unsupported image type")
|
16 |
return output
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
iface = gr.Interface(
|
19 |
fn=remove_background,
|
20 |
+
inputs=gr.Image(label="Upload Image"),
|
21 |
+
outputs=gr.Image(label="Output Image")
|
|
|
|
|
22 |
)
|
23 |
|
24 |
+
if __name__ == "__main__":
|
25 |
+
iface.launch()
|