Segment With Prompt API
Documentation on our Segment With Prompt API!
API Spec
Using unified Create and Fetch API in Image Editing API.
Request task_input
{
"task_input": {
"image": "https://st.mngbcn.com/rcs/pics/static/T5/fotos/outfit/S20/57034757_56-99999999_01.jpg", //url of the target image, both width and height of the image should be no more than 3072 pixels
"prompt": "clothes,shoes", //the semantic prompt of the things that you want to segment, sperate by comma
"negative_prompt": "pants", //the semantic prompt of the things that you do not want to segment, sperate by comma
"segment_factor": -15 //pixels that expand or shrink on the edge, positive integer stands for expansion, otherwise is shrink
}
}
Response task_output
{
"task_output": {
"image_base64s": null,
"image_urls": [
"https://img.midjourneyapi.xyz/temp/a164d518-9f7d-404e-8ea9-85e5b628f39b.png",
"https://img.midjourneyapi.xyz/temp/6a363d4d-a4e6-4cfc-882a-7269ef2afe48.png",
"https://img.midjourneyapi.xyz/temp/e929cb9d-d0f3-4f24-9eeb-4aa309ea1aeb.png",
"https://img.midjourneyapi.xyz/temp/90d06d7b-b4bd-449d-8e7d-a85628fad926.png"
]
}
}
Request Example
curl --location 'https://api.goapi.ai/api/image_toolkit/v2/create' \
--header 'X-API-KEY: {YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data '{
"task_type": "segment",
"result_type": "url",
"task_input": {
"image": "https://st.mngbcn.com/rcs/pics/static/T5/fotos/outfit/S20/57034757_56-99999999_01.jpg",
"prompt": "clothes,shoes",
"negative_prompt": "pants",
"segment_factor": -15
}
}'
Response Example
{
"code": 200,
"data": {
"task_id": "81f14faf-30c0-49e5-8d32-a12d4036a827",
"task_type": "segment",
"status": "success",
"task_info": {
"created_at": "2024-03-19T01:38:52.616245Z",
"started_at": "2024-03-19T01:38:54.514267Z",
"completed_at": "2024-03-19T01:38:58.19189Z",
"frozen_credits": 0,
"task_input": {
"image": "https://st.mngbcn.com/rcs/pics/static/T5/fotos/outfit/S20/57034757_56-99999999_01.jpg",
"negative_prompt": "pants",
"prompt": "clothes,shoes",
"segment_factor": -15
}
},
"task_result": {
"used_credits": 0,
"error_messages": [],
"task_output": {
"image_base64s": null,
"image_urls": [
"https://img.midjourneyapi.xyz/temp/a164d518-9f7d-404e-8ea9-85e5b628f39b.png",
"https://img.midjourneyapi.xyz/temp/6a363d4d-a4e6-4cfc-882a-7269ef2afe48.png",
"https://img.midjourneyapi.xyz/temp/e929cb9d-d0f3-4f24-9eeb-4aa309ea1aeb.png",
"https://img.midjourneyapi.xyz/temp/90d06d7b-b4bd-449d-8e7d-a85628fad926.png"
]
}
}
},
"message": "success"
}