1. API
  2. getLabels (image link)

API

getLabels (image link)

Get labels from a link to an image file (either https or ipfs).

📝 Notes

🌐 - Endpoint : https://name.pulsr.ai/v1/getLabels

🔑 - Your API key may be passed either via Header X-PULSR-API-KEY or by URL parameter ?key=. If you need an API key, please use our developer dashboard to set one up.

🖼️ - Supported image file-types include:

        ("image/jpeg", "image/png", "image/gif", "image/bmp", "image/webp", "image/tiff", "image/apng", "video/png", "image/avif")

      

🚀 How To

Make a POST request to the endpoint https://name.pulsr.ai/v1/getLabels where:

  • The req body contains an application/json payload with {url:<your IPFS or HTTPS URL string>}.
  • Your API key is supplied via either X-PULSR-API-KEY request header or in the ?=key query parameter.

💻 Code Example

        Node-JS

import fetch from 'node-fetch';

const payload = {url:"https://www.pulsr.ai/images/example-dog.jpg"}

const url = 'https://name.pulsr.ai/v1/getLabels';
const options = {
  method: 'POST',
  headers: {
    'accept': 'application/json',
    'X-PULSR-API-KEY': 'a479a23e-0ab8-4d8f-92a6-6c6f7abc8ec8',
    'Content-Type':'application/json'
  },
  body:JSON.stringify(payload)
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error('error:' + err));

/* Example Response:
{
  status: 'Found [10] labels',
  labels: [
    { label: 'Pug', confidence: 0.9699309468269348 },
    { label: 'Dog', confidence: 0.9631053805351257 },
    { label: 'Dog breed', confidence: 0.9219425916671753 },
    { label: 'Carnivore', confidence: 0.9029830098152161 },
    { label: 'Ear', confidence: 0.8495624661445618 },
    { label: 'Working animal', confidence: 0.831178605556488 },
    { label: 'Companion dog', confidence: 0.8248597979545593 },
    { label: 'Fawn', confidence: 0.8159297108650208 },
    { label: 'Whiskers', confidence: 0.813794732093811 },
    { label: 'Wrinkle', confidence: 0.7973707914352417 }
  ],
  labelsFound: true
}
*/