🔮Predictions
These methods are necessary in order to use some of the endpoints in this section.
to obtain a valid token use the following method: Authentication
To get the id of your projects you must go to the following method: List projects.
To get the models of your project you must go to the following method: Project information.
List Inputs for prediction:
GET
https://api.arkangel.ai/api/experiments/io/project/{{PROJECT_ID}}/model/{{MODEL_ID}}
Path Parameters
{{MODEL_ID}}*
UUID
Model ID
{{PROJECT_ID}}*
UUID
Project ID
Headers
TOKEN*
JWT
Bearer TOKEN
{
"status": 200,
"result": {
"id": "45a129d6-f421-44c2-8950-cde9fe82bffg",
"status": "done",
"createdAt": "2023-04-19T16:15:00.216Z",
"updatedAt": "2023-04-19T16:15:00.216Z",
"experimentsIO": [
{
"id": "5b255639-d3a8-418f-824d-92cc4627e690",
"io": true,
"alias": null,
"description": null,
"name": "id",
"dataType": "number_int",
"range": [
"3",
"399"
],
"createdAt": "2023-04-19T17:12:24.992Z",
"updatedAt": "2023-04-19T17:12:24.992Z"
},
{
"id": "bc4bc70a-a558-47d5-bcfb-9c3e46322e24",
"io": true,
"alias": null,
"description": null,
"name": "rc",
"dataType": "number_float",
"range": [
"2.1",
"8"
],
"createdAt": "2023-04-19T17:12:25.003Z",
"updatedAt": "2023-04-19T17:12:25.003Z"
},
{
"id": "ddc1868a-2c0c-44fb-abb2-47b1c75dbd92",
"io": true,
"alias": null,
"description": null,
"name": "rbc",
"dataType": "categorical",
"range": [
"normal",
"abnormal"
],
"createdAt": "2023-04-19T17:12:25.003Z",
"updatedAt": "2023-04-19T17:12:25.003Z"
}
]
}
}
Example request
import requests
url = "https://apidev.arkangel.ai/api/experiments/io/project/{{PROJECT_ID}}/model/{{MODEL_ID}}"
payload = ""
headers = {
'Authorization': 'Bearer {{TOKEN}}'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
const token = "{{TOKEN}}"
const projectId = "{{PROJECT_ID}}"
const modelId = "{{MODEL_ID}}"
const myHeaders = new Headers();
myHeaders.append("Authorization", `Bearer ${token}`);
const raw = "";
const requestOptions = {
method: 'GET',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch(`https://api.arkangel.ai/api/experiments/io/project/${projectId}/model/${modelId}`, requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
curl --location --globoff 'https://apidev.arkangel.ai/api/experiments/io/project/{{PROJECT_ID}}/model/{{MODEL_ID}}' \
--header 'Authorization: Bearer {{TOKEN}}' \
--data ''
Create public user:
This is important if you want to make inferences on projects that are enabled as public with users not registered in the app. If an already created email is sent, it will return the existing one.
POST
https://api.arkangel.ai/api/public-users
The body must be in JSON format
Request Body
email*
String
user email
{
"status": 201,
"result": {
"id": "6cc146ed-ecd5-4ba9-9547-51a453fc826c",
"email": "example_email@arkangel.ai",
"createdAt": "2024-05-17T18:43:07.560Z",
"updatedAt": "2024-05-17T18:43:07.560Z"
}
}
Example request
import requests
import json
url = "https://apidev.arkangel.ai/api/public-users"
payload = json.dumps({
"email": "example_email@arkangel.ai"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
const raw = JSON.stringify({
"email": "example_email@arkangel.ai"
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("{{API}}/api/public-users", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
curl --location --globoff 'https://apidev.arkangel.ai/api/public-users' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "example_email@arkangel.ai"
}'
Create prediction:
Create a prediction
POST
https://api.arkangel.ai/api/inference
The body must be in JSON format
Headers
TOKEN*
JWT
Bearer TOKEN (Not necessary if an inference is to be made with a public user)
If the project is public, you can make inferences without sending the token, but you must create a public user and send the id of the created user.
Request Body
projectId*
UUID
PROJECT_ID
modelId*
UUID
MODEL_ID
inputs*
Array<Inputs>
clientId
String
Name of inference (Not necessary if an inference is to be made with a public user)
publicUserId
UUID
PUBLIC_USER_ID
If you want to make an inference without providing the token, the publicUserId property is required.
{
"id": "8ee23c6a-441e-4d8c-9110-3ab2fefc6b79",
"comment": null,
"annotated": null,
"clientId": null,
"startInference": "2023-08-31T15:19:46.000Z",
"endInference": "2023-08-31T15:19:52.000Z",
"inputs": [
{
"name": "rc",
"value": "4.2",
"inferenceInputId": "b6c12361-d462-4be9-846f-ca73d8f7ffbf"
},
{
"name": "rbc",
"value": "normal",
"inferenceInputId": "463b4eb4-d892-46f3-9c09-aa86d8a2eb20"
},
{
"name": "pc",
"value": "abnormal",
"inferenceInputId": "b2100bc0-2e50-4efa-926a-6dc5979098cf"
}
],
"labels": [
{
"id": "fbe86179-c98c-493c-a8ec-b7f21d7f3b3f",
"name": "classification",
"classes": [
{
"explainabilities": [
{
"id": "0c463083-23a1-4748-a30c-f8abea40bffc",
"inferenceInputId": "b6c12361-d462-4be9-846f-ca73d8f7ffbf",
"value": "0.1166613112549300"
},
{
"id": "96d46890-8d98-41f9-a17a-35162ea91d62",
"inferenceInputId": "463b4eb4-d892-46f3-9c09-aa86d8a2eb20",
"value": "0.2366151378308200"
},
{
"id": "33a30934-b45c-4fa3-88ed-3469387e8287",
"inferenceInputId": "b2100bc0-2e50-4efa-926a-6dc5979098cf",
"value": "0.0025483931053800"
}
],
"result": "0.72316533327103",
"labelStr": "ckd"
},
{
"explainabilities": [
{
"id": "c4a91a27-5f58-497c-b3be-cdfb531da359",
"inferenceInputId": "b6c12361-d462-4be9-846f-ca73d8f7ffbf",
"value": "0.0555980612992000"
},
{
"id": "01ee0681-7fb7-45c2-b322-59d1302baa6d",
"inferenceInputId": "463b4eb4-d892-46f3-9c09-aa86d8a2eb20",
"value": "-0.2253670386386000"
},
{
"id": "148935bc-a4ad-43e0-9bb0-9cd0473f8368",
"inferenceInputId": "b2100bc0-2e50-4efa-926a-6dc5979098cf",
"value": "-0.1166613119150600"
}
],
"result": "0.27683460712433",
"labelStr": "notckd"
}
]
}
],
"annotations": []
}
{
"id": "9d7870ng-c8fb-4934-9d37-0a4a4d12b577",
"comment": null,
"annotated": null,
"clientId": null,
"startInference": "2023-08-31T15:31:52.000Z",
"endInference": "2023-08-31T15:31:53.000Z",
"inputs": [
{
"name": "Year",
"value": "2004",
"inferenceInputId": "a6be6219-c7d8-4053-ac97-d29ee633a9bb"
},
{
"name": "AdultMortality",
"value": "338.5",
"inferenceInputId": "70c94d78-d677-4db8-ba39-87eb71be2ff4"
},
{
"name": "infantdeaths",
"value": "653.6",
"inferenceInputId": "80da716f-78c0-4b22-814d-1fed6972ad6f"
}
],
"labels": [
{
"id": "3c04d653-61bf-436b-aadc-6b9e25ae257f",
"name": "example_name",
"result": "0.67905431985855",
"explainabilities": [
{
"id": "cd9d4315-90d2-4002-9387-942df9334c39",
"inferenceInputId": "a6be6219-c7d8-4053-ac97-d29ee633a9bb",
"value": "0.0080298891355800"
},
{
"id": "f100c6b1-3bdf-4c37-863b-43e2a8175b07",
"inferenceInputId": "70c94d78-d677-4db8-ba39-87eb71be2ff4",
"value": "0.0206342157852200"
},
{
"id": "614d41d9-f452-4363-923f-564fdd95a9d8",
"inferenceInputId": "80da716f-78c0-4b22-814d-1fed6972ad6f",
"value": "0.0384177504005600"
}
]
}
],
"annotations": []
}
Example request for tabulated classification data:
import requests
import json
url = "https://api.arkangel.ai//api/inference"
predict_dic = {}
predict_dic['projectId'] = "{{PROJECT_ID}}"
predict_dic['modelId'] = "{{MODEL_ID}}"
# The number of inputs are given by the number of columns or variables
# used to train the experiment.
# Value can be any number, or if the column is categorical, variable
# must be a string that the experiment has already seen.
# For example:
# the experiment has been trained with the inputs ['red','green','blue']
# then value must be 'red', 'green', or 'blue' it can not be 'yellow'
predict_dic['inputs'] =[
{
"id": "870fc9cb-6c8e-4d7c-9e75-11631a67a137",
"input": 2015
},
{
"id": "27a9d20a-9c89-42b6-a91c-99ab1c315850",
"name": "AdultMortality",
"input": 263
}
]
# Transform dictionary to json response
payload = json.dumps(predict_dic, indent=4)
headers = {
'Authorization': 'Bearer {{TOKEN}}',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
const token = "{{TOKEN}}";
const projectId = "{{PROJECT_ID}}";
const modelId = "{{MODEL_ID}}";
const myHeaders = new Headers();
myHeaders.append("Authorization", `Bearer ${token}`);
myHeaders.append("Content-Type", "application/json");
const raw = JSON.stringify({
"projectId": projectId,
"modelId": modelId,
"inputs": [
{
"id": "27a9d20a-9c89-42b6-a91c-99ab1c315850",
"input": 2015
},
{
"id": "27a9d20a-9c89-42b6-a91c-99ab1c315851",
"input": 263
}
]
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.arkangel.ai/api/inference", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
curl --location --request POST 'https://api.arkangel.ai/api/inference' \
--header 'Authorization: Bearer {{TOKEN}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"projectId": "{{PROJECT_ID}}",
"modelId": "{{MODEL_ID}}",
"inputs": [
{
"id": "27a9d20a-9c89-42b6-a91c-99ab1c315850",
"input": 2015
},
{
"id": "27a9d20a-9c89-42b6-a91c-99ab1c315851",
"input": 263
}
]
}'
Example request for image data classification
import requests
import json
# For this method it is not necessary to use List Inputs method
# It automatically obtains the image ID since only one is needed.
url = "https://api.arkangel.ai/api/experiments/io/{{MODEL_ID}}"
payload = ""
headers = {
'Authorization': 'Bearer {{TOKEN}}'
}
img_id = requests.request("GET", url, headers=headers, data=payload)
img_id = json.loads(img_id.text)
img_id["result"]["experimentsIO"][0]["id"]
url = "https://api.arkangel.ai/api/inference"
# The image that is going to be used for the prediction must
# Be in base 64 format
payload = json.dumps({
"userId": "{{USER_ID}}",
"projectId": "{{PROJECT_ID}}",
"modelId": "{{MODEL_ID}}",
"inputs": [
{
"id": img_index,
"input": "{{IMAGE_TRANSFORMED_INTO_BASE64}}"
}
]
})
headers = {
'Authorization': 'Bearer {{TOKEN}}',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
const token = "{{TOKEN}}";
const projectId = "{{PROJECT_ID}}";
const modelId = "{{MODEL_ID}}";
const myHeaders = new Headers();
myHeaders.append("Authorization", `Bearer ${token}`);
myHeaders.append("Content-Type", "application/json");
const raw = JSON.stringify({
"projectId": projectId,
"modelId": modelId,
"inputs": [
// The images have to be converted to Base64.
{
"id": "27a9d20a-9c89-42b6-a91c-99ab1c315852",
"input": "image in base64"
}
]
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.arkangel.ai/api/inference", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
curl --location --request POST 'https://api.arkangel.ai/api/inference' \
--header 'Authorization: Bearer {{TOKEN}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"projectId": "{{PROJECT_ID}}",
"modelId": "{{MODEL_ID}}",
"inputs": [
{
"id": "27a9d20a-9c89-42b6-a91c-99ab1c315852",
"input": "image in base64"
}
]
}'
Create multiple predictions:
POST
https://api.arkangel.ai/api/inference/batch
This method will allow you to make more than one prediction at a time, you will have to send a .csv file, it will respond with an equal file, which contains the errors of the predictions if it found any error, if the file is empty no inferences with typing errors or similar were found. The correct predictions will be made and when they are complete, the file with the results will be sent to the email, and the results can also be obtained through the endpoint of list predictions.
Headers
TOKEN*
JWT
Bearer TOKEN
Request Body
modelIds*
Array
[ MODEL_IDS ]
projectId*
String
PROJECT_ID
batch*
File
This will be the .csv containing the predictions
{
"status": 201,
"result": "Multi-inference started"
}
Example of use for example_file.csv
Name
Year
Age
Example 1
Carlos
1999
23
Example 2
Marina
1995
27
The CSV file should have a maximum of 50.000 cells.
Example request
import requests
url = "https://apidev.arkangel.ai/api/inference/batch"
payload = {
'projectId': '{{PROJECT_ID}}',
'modelIds': [ '{{MODEL_ID}}' ]
}
files=[
('batch',('example_file.csv', open('/home/user/Downloads/example_file.csv','rb'), 'text/csv'))
]
headers = {
'Authorization': 'Bearer {{TOKEN}}'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
const token = "{{TOKEN}}";
const projectId = "{{PROJECT_ID}}";
const modelId = "{{MODEL_ID}}";
const myHeaders = new Headers();
myHeaders.append("Authorization", `Bearer ${token}`);
const formdata = new FormData();
formdata.append("projectId", projectId);
formdata.append("modelIds", [ modelId ]);
formdata.append("batch", file); // "example_file.csv"
const requestOptions = {
method: 'POST',
headers: myHeaders,
body: formdata,
redirect: 'follow'
};
fetch("https://apidev.arkangel.ai/api/inference/batch", requestOptions)
.then(response => response.blob({ type: "text/csv;charset=utf-8;" }))
.then(result=> console.log(result))
.catch(error => console.log('error', error));
curl --location --globoff 'https://api.arkangel.ai/api/inference/batch' \
--header 'Authorization: Bearer {{TOKEN}}' \
--form 'projectId="{{PROJECT_ID}}"' \
--form 'modelIds="[\"{{MODEL_ID}}\"]"' \
--form 'batch=@"/home/user/documents/example_file.csv"'
List predictions:
List a predictions
GET
https://api.arkangel.ai/api/inference/project/{{PROJECT_ID}}/model/{{MODEL_ID}}
Path Parameters
{{PROJECT_ID}}*
UUID
Project ID
{{MODEL_ID}}*
UUID
Model ID
Query Parameters
limit*
int
{{LIMIT}}
offset*
int
{{OFFSET}}
{
"total": 3,
"data": [
{
"id": "8ee23c6a-881e-4d8c-9110-3ab2fefc6b88",
"prediction": "ckd",
"result": "0.72316533327103",
"modelId": "c3c7ca91-c3f1-4982-a54c-25253ab36c78",
"comment": null,
"clientId": null,
"createdAt": "2023-08-31T15:19:52.151Z",
"updatedAt": "2023-08-31T15:19:52.151Z"
},
{
"id": "113d2c1f-79fe-4665-b02e-4313e1b9c896",
"prediction": "ckd",
"result": "0.75037169456482",
"modelId": "c3c7ca91-c3f1-4982-a54c-25253ab36c78",
"comment": null,
"clientId": null,
"createdAt": "2023-08-29T16:12:48.223Z",
"updatedAt": "2023-08-29T16:12:48.223Z"
},
{
"id": "5bd0dac0-61c3-46a3-b5eb-f1aeb484cb35",
"prediction": "notckd",
"result": "0.67639052867889",
"modelId": "c3c7ca91-c3f1-4982-a54c-25253ab36c78",
"comment": null,
"clientId": null,
"createdAt": "2023-05-17T20:47:57.489Z",
"updatedAt": "2023-05-17T20:47:57.489Z"
}
]
}
Example request
import requests
# Replace this with the corresponding information
PROJECT_ID = '{{PROJECT_ID}}'
MODEL_ID = '{{MODEL_ID}}'
LIMIT = '{{LIMIT}}'
OFFSET = '{{OFFSET}}'
url = f"https://api.arkangel.ai/api/inference/project/{PROJECT_ID}/model/{MODEL_ID}?limit={LIMIT}&offset={OFFSET}"
payload={}
# Obtain user's web token
headers = {
'Authorization': 'Bearer {{TOKEN}}'
}
# Configure the information created before of the project and obtain response
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
const token = "{{TOKEN}}";
const projectId = "{{PROJECT_ID}}";
const modelId = "{{MODEL_ID}}";
const limit = 10;
const offset = 0;
const myHeaders = new Headers();
myHeaders.append("Authorization", `Bearer ${token}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch(`https://api.arkangel.ai/api/inference/project/${projectId}/model/${modelId}?limit=${limit}&offset=${offset}`, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
curl --location --request GET 'https://api.arkangel.ai/api/inference/project/{{PROJECT_ID}}/model/{{MODEL_ID}}?limit={{LIMIT}}&offset={{OFFSET}}' \
--header 'Authorization: Bearer {{TOKEN}}'
List Prediction:
GET
https://api.arkangel.ai/api/inference/{{INFERENCE_ID}}
Path Parameters
Inference Id*
UUID
{{INFERENCE_ID}}
{
"status": 200,
"result": {
"id": "{{INFERENCE_ID}}",
"startInference": "2022-10-12T22:53:02.000Z",
"endInference": "2022-10-12T22:53:05.000Z",
"inputs": [
{
"name": "BMI",
"value": "16.6",
"inferenceInputId": "ca7581c2-5bc0-42de-9ee1-b9550f78cace"
},
{
"name": "Smoking",
"value": "1",
"inferenceInputId": "605f426d-dde2-4e40-903c-b1a905ab4d30"
}
],
"labels": [
{
"id": "870fcf8e-07d7-4932-9528-220a144bbe2b",
"name": "Target",
"classes": [
{
"explainabilities": [
{
"id": "8201cc2a-8f93-4f16-90eb-a1bff5058208",
"inferenceInputId": "ca7581c2-5bc0-42de-9ee1-b9550f78cace",
"value": "0.0104488377621390"
},
{
"id": "a6c01a95-08c2-4e78-aeeb-54294807a9d6",
"inferenceInputId": "605f426d-dde2-4e40-903c-b1a905ab4d30",
"value": "0.0052993741086582"
}
],
"result": "0.00000000001003",
"labelStr": "Yes"
},
{
"explainabilities": [
{
"id": "a7035d95-b7f2-42c9-b659-0d51d340829b",
"inferenceInputId": "ca7581c2-5bc0-42de-9ee1-b9550f78cace",
"value": "-0.0107978574070894"
},
{
"id": "8032c322-7be6-48d1-a7ba-888db1c0c51f",
"inferenceInputId": "605f426d-dde2-4e40-903c-b1a905ab4d30",
"value": "-0.0053141740812033"
}
],
"result": "1.00000000000000",
"labelStr": "No"
}
]
}
]
}
}
{
"id": "{{INFERENCE_ID}}",
"startInference": "2022-12-16T21:49:36.000Z",
"endInference": "2022-12-16T21:49:37.000Z",
"inputs": [
{
"name": "Year",
"value": "2010",
"inferenceInputId": "9f809662-f849-4c2f-87a3-32b3ca2fd870"
},
{
"name": "Mortality",
"value": "70",
"inferenceInputId": "d735dbb6-831f-467c-8ad8-014bfb399e3d"
}
],
"labels": [
{
"id": "09bd62cc-e78f-4598-91c6-b621dde15f7b",
"name": "death",
"result": "175.33518570661545",
"explainabilities": [
{
"id": "36434ee5-def3-4911-9db9-f0882626602e",
"inferenceInputId": "9d009ea9-2537-45c0-a830-78088bbe1ca2",
"value": "-0.0570819394940800"
},
{
"id": "078aa033-5687-43f6-9c83-29a9153118d0",
"inferenceInputId": "886d3954-c9a4-454b-b7ee-9bea90bdd286",
"value": "0.0290308273450400"
}
]
}
]
}
{
"status": 200,
"result": {
"id": "{{INFERENCE_ID}}",
"startInference": "2022-09-17T23:44:03.000Z",
"endInference": "2022-09-17T23:44:08.000Z",
"inputs": "https://api.arkangel.ai/images/d3e0ee5be7eb4a7e683e7a4605d5310082bd.png",
"labels": [
{
"id": "9e48bbdb-3583-45ea-afc9-89b727bcf65c",
"name": "Animal",
"classes": [
{
"result": "0.00000000000011",
"labelStr": "Perro"
},
{
"result": "0.99999988079071",
"labelStr": "Gato"
}
]
}
]
}
}
{
"status": 200,
"result": {
"id": "{{INFERENCE_ID}}",
"startInference": "2022-10-07T14:39:12.000Z",
"endInference": "2022-10-07T14:39:20.000Z",
"inputs": "https://api.arkangel.ai/images/1c51a8c8246b25dcac0bcc7df179c56ddd29.jpeg",
"confidencePrediction": [
{
"labelStr": "Carro",
"result": "0.86016124486923",
"boundingBox": [
"0.422422856092453",
"0.44568416476249695",
"0.6098942756652832",
"0.5190061330795288"
]
},
{
"labelStr": "Persona",
"result": "0.32046729326248",
"boundingBox": [
"0.5168230533599854",
"0.4071381092071533",
"0.707597017288208",
"0.4853692650794983"
]
},
{
"labelStr": "Perro",
"result": "0.25262472033501",
"boundingBox": [
"0.5129784345626831",
"0.4877077639102936",
"0.6648222208023071",
"0.6258601546287537"
]
}
]
}
}
Example request
import requests
# Replace this with the inference ID
INFERENCE_ID= '{{INFERENCE_ID}}'
url = "https://api.arkangel.ai/api/inference/{{INFERENCE_ID}}"
payload={}
# Obtain user's web token
headers = {
'Authorization': 'Bearer {{TOKEN}}'
}
# Configure the information created before of the project and obtain response
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
const token = "{{TOKEN}}";
const inferenceId = "{{INFERENCE_ID}}"
const myHeaders = new Headers();
myHeaders.append("Authorization", `Bearer ${token}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch(`https://api.arkangel.ai/api/inference/${inferenceId}`, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
curl --location --request GET 'https://api.arkangel.ai/api/inference/{{INFERENCE_ID}} \
--header 'Authorization: Bearer {{TOKEN}}'
List Targets of the model:
GET
https://api.arkangel.ai/api/models/{{MODEL_ID}}/labels
Path Parameters
MODEL_ID*
UUID
{{MODEL_ID}}
{
"status": 200,
"result": [
{
"id": "UUID",
"nameStr": "target name",
"createdAt": "2023-02-24T17:50:31.614Z",
"updatedAt": "2023-02-24T17:50:31.614Z",
"classes": []
}
]
}
{
"status" 200,
"result": [
{
"id": "UUID",
"nameStr": "Target name",
"createdAt": "2022-11-25T17:22:13.664Z",
"updatedAt": "2022-11-25T17:22:13.664Z",
"classes": [
{
"id": "UUID",
"labelStr": "name option 1",
"createdAt": "2022-11-25T17:22:13.664Z",
"updatedAt": "2022-11-25T17:22:13.664Z"
},
{
"id": "UUID",
"labelStr": "name option 2",
"createdAt": "2022-11-25T17:22:13.664Z",
"updatedAt": "2022-11-25T17:22:13.664Z"
}
]
}
]
}
Example request
import requests
# Replace this with the model ID
MODEL_ID= '{{MODEL_ID}}'
url = "https://api.arkangel.ai/api/models/{{MODEL_ID}}/labels"
payload={}
# Obtain user's web token
headers = {
'Authorization': 'Bearer {{TOKEN}}'
}
# Configure the information created before of the project and obtain response
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
const token = "{{TOKEN}}";
const modelId = "{{MODEL_ID}}";
const myHeaders = new Headers();
myHeaders.append("Authorization", `Bearer ${token}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch(`https://api.arkangel.ai/api/models/${modelId}/labels`, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
curl --location 'https://apidev.arkangel.ai/api/models/{{MODEL_ID}}/labels' \
--header 'Authorization: Bearer {{TOKEN}}'
Annotate prediction:
GET
https://api.arkangel.ai/api/inference/annotations
Request Body
inferenceId*
UUID
INFERENCE_ID
annotations*
Array<object>
Annotations by Target - Objects for each Target of the project
annotated*
Boolean
Type of annotation - true: valid annotation | false: invalid annotation
{
"status": 200,
"result": {
"annotated": false,
"annotations" : [
{
"labelId": "UUID",
"labelStr": "Label of the target",
"annotated": "value of the annotation",
"createdAt": "2023-03-27T15:29:30.088Z",
"updatedAt": "2023-03-27T15:29:30.088Z"
}
],
"clientId": "",
"comment": "",
"endInference": "2023-03-27T15:29:24.000Z",
"id": "INFERENCE_ID",
"inputs": [],
"labels": [],
"startInference": "2023-03-27T15:29:22.000Z"
}
}
{
"status": 200,
"result": {
"annotated": false,
"annotations" : [
{
"labelId": "UUID",
"labelStr": "Label of the target",
"annotated": "value of the annotation",
"createdAt": "2023-03-27T15:29:30.088Z",
"updatedAt": "2023-03-27T15:29:30.088Z"
}
],
"clientId": "",
"comment": "",
"endInference": "2023-03-27T15:29:24.000Z",
"id": "INFERENCE_ID",
"inputs": [],
"labels": [],
"startInference": "2023-03-27T15:29:22.000Z"
}
}
Example request
import requests
# Replace this with the inference ID
INFERENCE_ID= '{{INFERENCE_ID}}'
url = "https://apidev.arkangel.ai/api/inference/annotations"
payload={
'inferenceId': INFERENCE_ID,
"annotated" : true | false,
# Objects for each Target of the project
# This field is only sent if the property "annotated" is true
'annotations': [
# Example if the project is of type Classification
{
"labelId": "TARGET_ID",
"classId": "CLASS_ID"
},
# Example if the project is of type Regression
{
"labelId": "TARGET_ID",
"result": "Number value"
}
]
}
# Obtain user's web token
headers = {
'Authorization': 'Bearer {{TOKEN}}'
}
# Configure the information created before of the project and obtain response
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
const token = "{{TOKEN}}";
const inferenceId = "{{INFERENCE_ID}}"
const modelId = "{{MODEL_ID}}";
const myHeaders = new Headers();
myHeaders.append("Authorization", `Bearer ${token}`);
const data = {
'inferenceId': inferenceId,
"annotated" : true | false,
// Objects for each Target of the project
// This field is only sent if the property "annotated" is true
'annotations': [
// Example if the project is of type Classification
{
"labelId": "TARGET_ID",
"classId": "CLASS_ID"
},
// Example if the project is of type Regression
{
"labelId": "TARGET_ID",
"result": "Number value"
}
]
}
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
body: data
};
fetch("https://apidev.arkangel.ai/api/inference/annotations", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
curl --location 'https://apidev.arkangel.ai/api/inference/annotations' \
--data '{
"inferenceId": "",
"annotated" : true | false,
"annotations": [
{
"labelId": "TARGET_ID",
"result": "CLASS_ID"
},
{
"labelId": "TARGET_ID",
"result": "Number value"
}
]
}'
Last updated