Custom API

We could also support custom API in case you want to use your own model, by telling us the API URL. All you need to do is making sure that the API complies to the request structure.

If you choose Custom, you can simply enter a custom API URL and load in any API of your own choice. You can see a Custom API sample preview by clicking the button beside the text field.

Set up your Custom API

  1. Fill in custom API URL

  2. You can find API request body and response sample beside API URL dialog or examples below

  3. Click "Predict Labels" to apply labels to your document

Span Labeling Sample

Request Body
{
  "id": "[project_id]",
  "name": "[project_name]",
  "documents": [
    {
      "id": "[document_id_1]",
      "name": "[document_file_name_1]",
      "sentences": [
        {
          "id": 0, // zero-based line number of the document
          "text": "first message",
          "metadata": []
        },
        {
          "id": 1,
          "text": "first message",
          "metadata": []
        },
      ]
    }
  ]
}
Response
{
  "id": "[project_id]",
  "documents": [
    {
      "id": "[document_id_1]",
      "labels": [
        {
          "id": 0,
          "entities": [
            {
              "label": "LOCATION",
              "start_char": 10,
              "end_char": 18,
              "layer": 0
            },
            {
              "label": "PERSON",
              "start_char": 20,
              "end_char": 29,
              "layer": 1
            },
          ]
        },
        {
          "id": 1,
          "entities": []
        }
      ]
    }
  ]
}

Row Labeling Sample

Request Body
[
  { "id": 0, "text": "I feel good." },
  { "id": 1, "text": "I don't like it." }
]
Response
[
  { "id": 0, "label": "POSITIVE" },
  { "id": 1, "label": "NEGATIVE" }
]

Last updated