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