Skip to main content
POST
/
models
/
v2
/
facebook
/
sam-vit-base
mask-generation
curl --request POST \
  --url https://api.bytez.com/models/v2/facebook/sam-vit-base \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "url": "https://huggingface.co/datasets/huggingfacejs/tasks/resolve/main/mask-generation/mask-generation-input.png",
  "base64": "data:image/png;base64,...BASE_64_GOES_HERE (Only use this is you are not using a url)"
}
'
{
  "error": "<string>",
  "output": {
    "input_image_dimensions": {
      "width": 1264,
      "height": 770
    },
    "masks": [
      [
        [
          0,
          0,
          0
        ]
      ],
      [
        [
          1,
          1,
          1
        ]
      ],
      [
        [
          1,
          0,
          1
        ]
      ]
    ],
    "scores": [
      0.996,
      0.999,
      0.601
    ]
  }
}

Authorizations

Authorization
string
header
required

Set Authorization header to BYTEZ_KEY 'Authorization: YOUR_BYTEZ_KEY_HERE'

Body

application/json

Schema for mask-generation models

url
string
required
Example:

"https://huggingface.co/datasets/huggingfacejs/tasks/resolve/main/mask-generation/mask-generation-input.png"

base64
string
Example:

"data:image/png;base64,...BASE_64_GOES_HERE (Only use this is you are not using a url)"

Response

Successful mask-generation response.

error
string | null
required

Null on success; otherwise an error message.

output
object
required

Successful response with the mask image URL

Example:
{
"input_image_dimensions": { "width": 1264, "height": 770 },
"masks": [[[0, 0, 0]], [[1, 1, 1]], [[1, 0, 1]]],
"scores": [0.996, 0.999, 0.601]
}