Predict API Docs for:
This interface takes in 1 input(s) and returns 1 output(s).
The URL endpoint is:
Input(s): [ Textbox ]
- Textbox accepts the text input as type str
Output(s): [ Label ]
- Label returns the Object with key 'label' representing primary label, and key 'confidences' representing a list of label-confidence pairs as type Dict[label: str, confidences: List[Dict[label: str, confidence: number]]]
Payload:
{
"data": [ str ]
}
Response:
{
"data": [ Dict[label: str, confidences: List[Dict[label: str, confidence: number]]] ],
"durations": [ float ], # the time taken for the prediction to complete
"avg_durations": [ float ] # the average time taken for all predictions so far (used to estimate the runtime)
}
Try it (live demo):
import requests
r = requests.post(url='
',
json={"data":
["I\u0027ve been waiting for a HuggingFace course my whole life."]})
r.json()
curl -X POST
-H 'Content-Type: application/json' -d '{"data": ["I\u0027ve been waiting for a HuggingFace course my whole life."]}'
fetch('', { method: "POST", body: JSON.stringify({"data":[ "I\u0027ve been waiting for a HuggingFace course my whole life."
]}), headers: { "Content-Type": "application/json" } }).then(function(response) { return response.json(); }).then(function(json_response){ console.log(json_response) })
{
"data": ,
"durations": ,
"avg_durations":
}