Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -16,13 +16,84 @@ def remove_background(image):
|
|
16 |
raise TypeError("Unsupported image type")
|
17 |
return output
|
18 |
|
|
|
19 |
iface = gr.Interface(
|
20 |
fn=remove_background,
|
21 |
inputs=gr.Image(label="Upload Image"),
|
22 |
outputs=gr.Image(label="Output Image"),
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
)
|
27 |
|
28 |
if __name__ == "__main__":
|
|
|
16 |
raise TypeError("Unsupported image type")
|
17 |
return output
|
18 |
|
19 |
+
# Gradio Interface
|
20 |
iface = gr.Interface(
|
21 |
fn=remove_background,
|
22 |
inputs=gr.Image(label="Upload Image"),
|
23 |
outputs=gr.Image(label="Output Image"),
|
24 |
+
css="""
|
25 |
+
body {
|
26 |
+
font-family: 'Arial', sans-serif;
|
27 |
+
background-color: #1a1a2e;
|
28 |
+
color: #ffffff;
|
29 |
+
}
|
30 |
+
|
31 |
+
.gradio-container {
|
32 |
+
background-color: #1a1a2e;
|
33 |
+
color: #ffffff;
|
34 |
+
}
|
35 |
+
|
36 |
+
.gr-button {
|
37 |
+
background-color: #4CAF50;
|
38 |
+
color: white;
|
39 |
+
border: none;
|
40 |
+
border-radius: 4px;
|
41 |
+
}
|
42 |
+
|
43 |
+
.gr-button:hover {
|
44 |
+
background-color: #45a049;
|
45 |
+
}
|
46 |
+
|
47 |
+
.gr-input, .gr-output {
|
48 |
+
background-color: #2a2a3e;
|
49 |
+
color: #ffffff;
|
50 |
+
border: 1px solid #4a4a5e;
|
51 |
+
}
|
52 |
+
|
53 |
+
.gr-input:focus, .gr-output:focus {
|
54 |
+
outline: none;
|
55 |
+
border-color: #6a6a7e;
|
56 |
+
}
|
57 |
+
|
58 |
+
.gr-file-upload {
|
59 |
+
background-color: #2a2a3e;
|
60 |
+
color: #ffffff;
|
61 |
+
}
|
62 |
+
|
63 |
+
.gr-slider {
|
64 |
+
background-color: #2a2a3e;
|
65 |
+
color: #ffffff;
|
66 |
+
}
|
67 |
+
|
68 |
+
.gr-dropdown {
|
69 |
+
background-color: #2a2a3e;
|
70 |
+
color: #ffffff;
|
71 |
+
}
|
72 |
+
|
73 |
+
.gr-image-preview {
|
74 |
+
border: 2px solid #4a4a5e;
|
75 |
+
background-color: #2a2a3e;
|
76 |
+
}
|
77 |
+
|
78 |
+
.gr-image-preview img {
|
79 |
+
max-width: 100%;
|
80 |
+
height: auto;
|
81 |
+
object-fit: contain;
|
82 |
+
}
|
83 |
+
|
84 |
+
.gr-textbox {
|
85 |
+
background-color: #2a2a3e;
|
86 |
+
color: #ffffff;
|
87 |
+
border: 1px solid #4a4a5e;
|
88 |
+
}
|
89 |
+
|
90 |
+
.gr-textbox:focus {
|
91 |
+
outline: none;
|
92 |
+
border-color: #6a6a7e;
|
93 |
+
}
|
94 |
+
""",
|
95 |
+
title="Background Remover",
|
96 |
+
description="Upload an image to remove its background.",
|
97 |
)
|
98 |
|
99 |
if __name__ == "__main__":
|