Loomisgitarrist commited on
Commit
804b64d
1 Parent(s): 37e61cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -20
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
- iface = gr.Interface(fn=segment,
8
- inputs=[gr.Image(type='pil', label='Image'),
9
- gr.Dropdown(choices=["Hat", "Upper-clothes", "Skirt", "Pants", "Dress", "Belt", "Left-shoe", "Right-shoe", "Scarf"],
10
- value=["Hat", "Upper-clothes", "Skirt", "Pants", "Dress", "Belt", "Left-shoe", "Right-shoe", "Scarf"],
11
- multiselect=True,
12
- label='Clothing')],
13
- outputs=gr.Image(label='Clothes Extractor'),
14
- title='Clothes Extractor',
15
- description="Upload an image of a person wearing clothing and select below which piece of clothing to extract from the image.",
16
- examples=[
17
- ['./1.jpg', ["Hat", "Upper-clothes", "Skirt", "Pants", "Dress", "Belt", "Left-shoe", "Right-shoe", "Scarf"]],
18
- ['./Model 1.jpg', ["Pants", "Upper-clothes"]],
19
- ['./Model 2.jpg', ["Pants", "Upper-clothes"]],
20
- ['./Model 3.jpg', ["Pants", "Upper-clothes"]],
21
- ['./Model 4.jpg', ["Pants", "Upper-clothes"]],
22
- ['./Model 5.jpg', ["Pants", "Upper-clothes"]],
23
- ['./Model 6.jpg', ["Pants", "Upper-clothes"]],
24
- ['./Model 7.jpg', ["Pants", "Upper-clothes"]],
25
- ],
26
- theme=gr.themes.Base(primary_hue="teal", secondary_hue="teal", neutral_hue="slate"))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()