Spaces:
Runtime error
Runtime error
Loomisgitarrist
commited on
Commit
•
804b64d
1
Parent(s):
37e61cd
Update app.py
Browse files
app.py
CHANGED
@@ -4,25 +4,46 @@ from SegCloth import segment_clothing
|
|
4 |
def segment(img, clothes):
|
5 |
return segment_clothing(img, clothes)
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
iface.launch()
|
|
|
4 |
def segment(img, clothes):
|
5 |
return segment_clothing(img, clothes)
|
6 |
|
7 |
+
custom_css = """
|
8 |
+
/* Remove box shadow and border from example images */
|
9 |
+
.gr-example-image {
|
10 |
+
box-shadow: none !important;
|
11 |
+
border: none !important;
|
12 |
+
}
|
13 |
+
|
14 |
+
/* Center example images */
|
15 |
+
.gr-example-image-wrapper {
|
16 |
+
display: flex;
|
17 |
+
justify-content: center;
|
18 |
+
}
|
19 |
+
"""
|
20 |
+
|
21 |
+
iface = gr.Interface(
|
22 |
+
fn=segment,
|
23 |
+
inputs=[
|
24 |
+
gr.Image(type='pil', label='Image'),
|
25 |
+
gr.Dropdown(
|
26 |
+
choices=["Hat", "Upper-clothes", "Skirt", "Pants", "Dress", "Belt", "Left-shoe", "Right-shoe", "Scarf"],
|
27 |
+
value=["Hat", "Upper-clothes", "Skirt", "Pants", "Dress", "Belt", "Left-shoe", "Right-shoe", "Scarf"],
|
28 |
+
multiselect=True,
|
29 |
+
label='Clothing'
|
30 |
+
)
|
31 |
+
],
|
32 |
+
outputs=gr.Image(label='Clothes Extractor'),
|
33 |
+
title='Clothes Extractor',
|
34 |
+
description="Upload an image of a person wearing clothing and select below which piece of clothing to extract from the image.",
|
35 |
+
examples=[
|
36 |
+
['./1.jpg', ["Hat", "Upper-clothes", "Skirt", "Pants", "Dress", "Belt", "Left-shoe", "Right-shoe", "Scarf"]],
|
37 |
+
['./Model 1.jpg', ["Pants", "Upper-clothes"]],
|
38 |
+
['./Model 2.jpg', ["Pants", "Upper-clothes"]],
|
39 |
+
['./Model 3.jpg', ["Pants", "Upper-clothes"]],
|
40 |
+
['./Model 4.jpg', ["Pants", "Upper-clothes"]],
|
41 |
+
['./Model 5.jpg', ["Pants", "Upper-clothes"]],
|
42 |
+
['./Model 6.jpg', ["Pants", "Upper-clothes"]],
|
43 |
+
['./Model 7.jpg', ["Pants", "Upper-clothes"]]
|
44 |
+
],
|
45 |
+
theme=gr.themes.Base(primary_hue="teal", secondary_hue="teal", neutral_hue="slate"),
|
46 |
+
css=custom_css
|
47 |
+
)
|
48 |
|
49 |
iface.launch()
|