File size: 1,332 Bytes
4e6f8d5 |
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 40 41 42 43 44 45 46 47 48 49 |
from handler import EndpointHandler
# init handler
my_handler = EndpointHandler(path="hf-hub:Styld/marqo-fashionSigLIP")
# prepare sample payload
embedding_input = {
"inputs": {
"batch": [
{
"image": "https://lp2.hm.com/hmgoepprod?set=source[/23/ab/23ab27480dd2dfc7007745402d3b8caaf756ee70.jpg],origin[dam],category[],type[DESCRIPTIVESTILLLIFE],res[m],hmver[2]&call=url[file:/product/style]",
"description": "test",
}
]
},
"type": "embedd",
}
classify_input = {
"inputs": {
"candidates": [
"Bohemian",
"Vintage",
"Streetwear",
"Preppy",
"Minimalist",
"Glamorous",
"Punk",
"Romantic",
"Classic",
"Avant-garde",
"Grunge",
"Retro",
"Gothic",
"Hippie",
"Eco-friendly",
],
"image": "https://static.zara.net/assets/public/bb1f/0983/a29f44e18ec9/3b7dd5791c67/05575420427-e1/05575420427-e1.jpg?ts=1708614949903&w=1126",
},
"type": "classify",
}
# test the handler
embedd_pred = my_handler(embedding_input)
classify_pred = my_handler(classify_input)
# show results
print("embedd_pred", embedd_pred)
print("classify_pred", classify_pred)
|