--- title: Segmentation emoji: 📉 colorFrom: indigo colorTo: red sdk: gradio sdk_version: 5.19.0 app_file: app.py pinned: false --- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference # Sending image file to api curl -X POST "https://alexgenovese-segmentation.hf.space/segment" \ -F "data=[{\"type\": \"image\", \"value\": null}]" \ -F "data=@woman_with_bag.jpeg" \ -H "Content-Type: multipart/form-data" \ -o response.json # Sending image file to api curl -X POST "https://alexgenovese-segmentation.hf.space/segment" \ -H "accept: application/json" \ -H "Content-Type: multipart/form-data" \ -F "file=@woman_with_bag.jpeg" \ -o response.json # Sending image in base 64 to api 1. base64 woman_with_bag.jpeg > image.b64 2. curl -X POST "https://alexgenovese-segmentation.hf.space/segment" \ -H "Content-Type: application/json" \ -d "{\"image_base64\": \"$(cat image.b64)\"}" or curl -X POST "https://alexgenovese-segmentation.hf.space/segment" \ -H "Content-Type: application/json" \ -d "{\"image_base64\": \"$(base64 woman_with_bag.jpeg)\"}" # Output {"mask":"data:image/png;base64...","annotations":{"mask":[[]]"label":"fashion"}} # Segmetn-url endpoint curl -X POST "https://alexgenovese-segmentation.hf.space/segment-url" \ -H "Content-Type: application/json" \ -d '{ "url": "https://plus.unsplash.com/premium_photo-1673210886161-bfcc40f54d1f?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8cGVyc29uJTIwc3RhbmRpbmd8ZW58MHx8MHx8&w=1000&q=80" }' \ -o response.json # Segment-clothes-url curl -X POST "https://alexgenovese-segmentation.hf.space/segment-clothes-url" \ -H "Content-Type: application/json" \ -d '{ "url": "https://plus.unsplash.com/premium_photo-1673210886161-bfcc40f54d1f?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8cGVyc29uJTIwc3RhbmRpbmd8ZW58MHx8MHx8&w=1000&q=80" }' \ -o response.json # Convert to ONNX file # For the fashion segmentation model: python convert_to_onnx.py --model "sayeed99/segformer-b3-fashion" --output "models/fashion_segformer.onnx" # For the clothes segmentation model: python convert_to_onnx.py --model "mattmdjaga/segformer_b2_clothes" --output "models/clothes_segformer.onnx" # Convert To Onnx file python3 hf_onnx_converter.py \ --source "mattmdjaga/segformer_b2_clothes" \ --target "alexgenovese/segformer-onnx"