Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
|
|
6 |
|
7 |
-
iface = gr.Interface(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|