Modellinferens


https://api.app.labelf.ai/v2/models/{model_id}/inference
Med den här ändpunkten kan du göra inferenser på en enskild modell som du har distribuerat. Max 8 texter per samtal.
Format för svar
JSON
Autentisering
Ja - Bärartoken

Exempel på cURL-förfrågan


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 }'

Exempel på svar


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 
      } 
    ] 
	} 
]
Ändra cookieinställningar