def probabilities():
"""
API route for getting the probabilities per category of the supplied text.
The request should have type set to application/json and the provided JSON
should have a text attribute containing the text for which we want to
get the probabilities per category
"""
try:
probabilities = ct.probability_per_category(request.json['document'])
return jsonify(probabilities=probabilities,
status=200)
except:
return jsonify(error=True,
status=500,
message='Getting the probabilities failed')
评论列表
文章目录