Model inference


https://api.app.labelf.ai/v2/models/{model_id}/inference
This endpoint allows you to do inference on a single model that you have deployed. Max 8 texts per call.
Response format
JSON
Authentication
Yes - Bearer token

Example cURL request


import requests

headers = {
    'Authorization': 'Bearer YOUR_BEARER_TOKEN',
}
# Replace texts with your own texts, max 8 text items in the texts array
json_data = {
    'texts': [
        'Breakfast was not tasty',
    ],
    'max_predictions': 2,
}

response = requests.post('https://api.app.labelf.ai/v2/models/YOUR_MODEL_ID/inference', headers=headers, json=json_data)

print(response.json())

fetch('https://api.app.labelf.ai/v2/models/YOUR_MODEL_ID/inference', {
    method: 'POST',
    headers: {
        'Authorization': 'Bearer YOUR_BEARER_TOKEN',
        'Content-Type': 'application/json'
    },
    // Replace texts with your own texts, max 8 text items in the texts array
    body: JSON.stringify({
        'texts': [
            'Breakfast was not tasty'
        ],
        'max_predictions': 2
    })
});

curl --location --request POST 'https://api.app.labelf.ai/v2/models/YOUR_MODEL_ID/inference' \
 --header 'Authorization: Bearer YOUR_BEARER_TOKEN' \ --header 'Content-Type: application/json' \
 --data-raw '{ "texts": ["Breakfast was not tasty"], "max_predictions": 2 }'

Example response


HTTP/1.1 200 OK 
Status: 200 OK 
Content-Type: application/json; 
charset=utf-8 
... 
[ 
	{ 
  	"text": "Breakfast was not tasty", 
    "predictions": [ 
    	{ 
      	"label": "positive", "score": 0.93 
      }, 
      {
      	"label": "neutral", "score": 0.03 
      } 
    ] 
	} 
]
Change Cookie Settings