Skip to main content
POST
/
models
/
v2
/
BilelDJ
/
clip-hugging-face-finetuned
zero-shot-image-classification
curl --request POST \
  --url https://api.bytez.com/models/v2/BilelDJ/clip-hugging-face-finetuned \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "url": "https://ocean.si.edu/sites/default/files/styles/3_2_largest/public/2023-11/Screen_Shot_2018-04-16_at_1_42_56_PM.png.webp?itok=Icvi-ek9",
  "candidate_labels": [
    "octopus",
    "cat",
    "lizard"
  ],
  "base64": "data:image/webp;base64,...BASE_64_GOES_HERE (Only use this is you are not using a url)"
}
'
{
  "error": "<string>",
  "output": [
    {
      "score": 0.3334539234638214,
      "label": "cat"
    },
    {
      "score": 0.3332984447479248,
      "label": "octopus"
    },
    {
      "score": 0.3332476019859314,
      "label": "lizard"
    }
  ]
}

Authorizations

Authorization
string
header
required

Set Authorization header to BYTEZ_KEY 'Authorization: YOUR_BYTEZ_KEY_HERE'

Body

application/json

Schema for zero-shot-image-classification models

url
string
required
Example:

"https://ocean.si.edu/sites/default/files/styles/3_2_largest/public/2023-11/Screen_Shot_2018-04-16_at_1_42_56_PM.png.webp?itok=Icvi-ek9"

candidate_labels
string[]
required
Example:
["octopus", "cat", "lizard"]
base64
string
Example:

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

Response

Successful zero-shot-image-classification response.

error
string | null
required

Null on success; otherwise an error message.

output
array
required

Successful response with image-classification scores and labels

Example:
[
{
"score": 0.3334539234638214,
"label": "cat"
},
{
"score": 0.3332984447479248,
"label": "octopus"
},
{
"score": 0.3332476019859314,
"label": "lizard"
}
]