Python
import requests url = "https://{FUSION HOST}/api/ai/ml-models/{modelId}/prediction" payload = { "text": "Hello world. How are you doing today?" } headers = {"Content-Type": "application/json"} response = requests.post(url, json=payload, headers=headers) print(response.json())
{ "score": [ "0.8543054461479187" ], "label": [ "positive" ], "_rawJsonResponse": "{\n \"names\": [\"label\", \"score\", \"tokens\", \"attention_weights\"],\n \"ndarray\": [[\"positive\"], [\"0.8543054461479187\"]]\n}" }
Get a prediction from the specified model.
OK
The response is of type object.
object
Was this page helpful?