predict.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:UrbanSearch 作者: urbansearchTUD 项目源码 文件源码
def predict():
    """
    API route for predicting the 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
    predict the category.
    """
    try:
        prediction = ct.predict(request.json['document'])

        return jsonify(category=str(prediction[0]),
                       status=200)
    except Exception as e:
        return jsonify(error=True,
                       status=500,
                       message='Getting the prediction failed')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号