This feature allows you to use an API to apply labels to multiple projects at once.
Last updated
The Programmatic API Labeling feature automates ML-assisted labeling. This feature is best suited for users who want to compare between their model and a human labeler, or between two models.
In this example, we will create a token-based project with 2 documents and 1 labeler. We will perform the auto labeling process against this project and add labels in the labeler's document.
The API request above returns a response containing the project id: “PROJECT_ID_1”, which is going to be used for the next set of API requests.
Initiate Backend to Perform Programmatic API Labeling
This operation will ask our backend to perform the auto**-**labeling task. We perform the request in chunks. For example, if you have 500 files and 5 files will be sent per request, it will require 100 API calls.
Note: the number of files that can be sent per request depends on your internal server.
Initiate auto-labeling for the Velociraptor API for labeler@datasaur.ai
Our backend will make several API requests based on the configuration provided from the request above. From the sample configuration above, our backend will make an API request to https://velociraptor.api/...
Sample API request
{
"id": "PROJECT_ID_1",
"name": "Stories",
"documents": [
{
"id": "DOCUMENT_ID_1",
"fileName": "little-prince.txt",
"sentences": [
{ "id": 0, "text": "The Little Prince is a novella by French aristocrat, writer, and aviator Antoine de Saint-Exupéry." },
{ "id": 1, "text": "It was first published in English and French in the US by Reynal & Hitchcock in April 1943, and posthumously in France following the liberation of France as Saint-Exupéry's works had been banned by the Vichy Regime." }
]
},
{
"id": "DOCUMENT_ID_2",
"fileName": "tragedy-of-hamlet.txt",
"sentences": [
{ "id": 0, "text": "The Tragedy of Hamlet, Prince of Denmark, often shortened to Hamlet (/ˈhæmlɪt/), is a tragedy written by William Shakespeare sometime between 1599 and 1601." },
{ "id": 1, "text": "It is Shakespeare's longest play with 30,557 words." }
]
},
]
}
Sample API response
The sample response below will apply two labels to the first document and three labels to the second document.