devendergarg14 commited on
Commit
15b2e0a
·
verified ·
1 Parent(s): 08e325d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -13
app.py CHANGED
@@ -1,17 +1,38 @@
1
  import gradio as gr
2
  from SegCloth import segment_clothing
3
 
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='Clothing Crop'),
14
- examples=[['./1.jpg', ["Hat", "Upper-clothes", "Skirt", "Pants", "Dress", "Belt", "Left-shoe", "Right-shoe", "Scarf"]]],
15
- theme = "Nymbo/Alyx_Theme"
16
- )
17
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
  from SegCloth import segment_clothing
3
 
4
+ def segment(img, clothes, face, hair, skin):
5
+ selected_items = clothes + face + hair + skin # Combine all selections into one list
6
+ return segment_clothing(img, selected_items)
7
 
8
+ iface = gr.Interface(
9
+ fn=segment,
10
+ inputs=[
11
+ gr.Image(type='pil', label='Image'),
12
+
13
+ # Clothes Category
14
+ gr.CheckboxGroup(choices=["Hat", "Upper-clothes", "Skirt", "Pants", "Dress", "Belt", "Left-shoe", "Right-shoe", "Scarf"],
15
+ value=["Hat", "Upper-clothes", "Skirt", "Pants", "Dress", "Belt", "Left-shoe", "Right-shoe", "Scarf"],
16
+ label='Clothes'),
17
+
18
+ # Face Category
19
+ gr.CheckboxGroup(choices=["Face", "Sunglasses"],
20
+ value=["Face", "Sunglasses"],
21
+ label='Face'),
22
+
23
+ # Hair Category
24
+ gr.CheckboxGroup(choices=["Hair"],
25
+ value=["Hair"],
26
+ label='Hair'),
27
+
28
+ # Skin Category
29
+ gr.CheckboxGroup(choices=["Left-arm", "Right-arm", "Left-leg", "Right-leg"],
30
+ value=["Left-arm", "Right-arm", "Left-leg", "Right-leg"],
31
+ label='Skin')
32
+ ],
33
+ outputs=gr.Image(label='Clothing Crop'),
34
+ examples=[['./1.jpg', ["Hat", "Upper-clothes", "Skirt", "Pants", "Dress", "Belt", "Left-shoe", "Right-shoe", "Scarf"]]],
35
+ theme="Nymbo/Alyx_Theme"
36
+ )
37
+
38
+ iface.launch()