Skip to content

Latest commit

History

History
62 lines (47 loc) 路 1.22 KB

classify.md

File metadata and controls

62 lines (47 loc) 路 1.22 KB

Classify

Given a sentence or paragraph, and a set of labels, compute probabilities of the text being assigned to either label http://api.vicgalle.net:5000/docs#/default/generate_classify_post

URL : /classify/

Method : POST

Data parameters

{
    "sequence": "[string, the text to be classified]",
    "labels": "[string, the classes separated by comma]",
}

Data example

{
    "sequence": "The movie started slow, but in the end was absolutely amazing!",
    "labels": "positive,neutral,negative",
}

Success Response

Code : 200 OK

Content example

scores are the probabilities for the labels, in the same order returned by labels.

{
  "sequence": "The movie started slow, but in the end was absolutely amazing!",
  "labels": [
    "positive",
    "neutral",
    "negative"
  ],
  "scores": [
    0.9768275618553162,
    0.019993752241134644,
    0.0031787161715328693
  ]
}

Python Example

import requests
payload = { 
    "sequence" : "The movie started slow, but in the end was absolutely amazing!", 
    "labels" : "positive,neutral,negative"}
response = requests.post("http://api.vicgalle.net:5000/classify", params=payload).json()
print(response)