Models API

The following APIs allow you to run inference on trained models.


List models

GET
/api/models
Get the list of models, optionally filtered by type, user, or query

Query Parameters

  • limitnumber?

  • offsetnumber?

  • typeTEXT_EMBEDDER | TEXT_CLASSIFIER | IMAGE_EMBEDDER | IMAGE_CLASSIFIER | IMAGE_SCORER?

  • userstring?

  • querystring?

    Search query

Output

  • itemsarray

  • totalPagesnumber

  • currentPagenumber

const result = await axios.get(
	`https://dibby.ai/api/models`,
);
{
  "items": [
    {
      "id": "abbfa6f1-5798-4e14-be31-4b334d98f324",
      "name": "model_name",
      "type": "TEXT_EMBEDDER",
      "desc": "some string",
      "user": {
        "name": "dibby"
      },
      "bestVersion": "some string",
      "versions": [
        {
          "name": "some string"
        }
      ]
    }
  ],
  "totalPages": 1,
  "currentPage": 0
}

Image Classifier inference

POST
/api/models/image_classifiers/{owner}/{model}/infer
Run an image classifier model on an image

Route Parameters

  • ownerstring

  • modelstring

Body Parameters

  • versionstring

  • imageimage

Output

  • classstring

    The predicted class

  • probabilitiesRecord<string, number>

    The probabilities of each class

  • confidencenumber

    The confidence of the prediction

const owner = 'some string';
const model = 'some string';
const result = await axios.post(
	`https://dibby.ai/api/models/image_classifiers/${owner}/${model}/infer`,
	{
	  "version": "clip-zs",
	  "image": "https://dibby.ai/image.jpg"
	}
);
{
  "class": "Apple",
  "probabilities": {
    "Apple": 0.9,
    "Banana": 0.1
  },
  "confidence": 0.9
}

Image Scorer inference

POST
/api/models/image_scorers/{owner}/{model}/infer
Run an image scorer model on an image

Route Parameters

  • ownerstring

  • modelstring

Body Parameters

  • versionstring

  • imageimage

Output

  • scorenumber

    The score of the image

const owner = 'some string';
const model = 'some string';
const result = await axios.post(
	`https://dibby.ai/api/models/image_scorers/${owner}/${model}/infer`,
	{
	  "version": "clip-zs",
	  "image": "https://dibby.ai/image.jpg"
	}
);
{
  "score": 0.54
}

Image Embedder inference

POST
/api/models/image_embedders/{owner}/{model}/infer
Run an image embedder model on an image

Route Parameters

  • ownerstring

  • modelstring

Body Parameters

  • versionstring

  • imageimage

Output

  • embeddingembedding

const owner = 'some string';
const model = 'some string';
const result = await axios.post(
	`https://dibby.ai/api/models/image_embedders/${owner}/${model}/infer`,
	{
	  "version": "clip",
	  "image": "https://dibby.ai/image.jpg"
	}
);
{
  "embedding": {
    "type": "CLIP",
    "value": [
      0.912,
      0.612,
      0.1235,
      0.512
    ]
  }
}

Text Classifier inference

POST
/api/models/text_classifiers/{owner}/{model}/infer
Run a text classifier model on a text

Route Parameters

  • ownerstring

  • modelstring

Body Parameters

  • versionstring

  • textstring

    The text to classify

Output

  • classstring

    The predicted class

const owner = 'some string';
const model = 'some string';
const result = await axios.post(
	`https://dibby.ai/api/models/text_classifiers/${owner}/${model}/infer`,
	{
	  "version": "gte-zs",
	  "text": "This is a great movie!"
	}
);
{
  "class": "Positive review"
}

Text Embedder inference

POST
/api/models/text_embedders/{owner}/{model}/infer
Run a text embedder model on a text

Route Parameters

  • ownerstring

  • modelstring

Body Parameters

  • versionstring

  • textstring

    The text to embed

Output

  • embeddingembedding

const owner = 'some string';
const model = 'some string';
const result = await axios.post(
	`https://dibby.ai/api/models/text_embedders/${owner}/${model}/infer`,
	{"version":"clip","text":"Hello, world!"}
);
{
  "embedding": {
    "type": "CLIP",
    "value": [
      0.912,
      0.612,
      0.1235,
      0.512
    ]
  }
}