Flask项目报错 The view function did not return a valid response. The return type must be a string, dict,

Flask项目报错 The view function did not return a valid response. The return type must be a string, dict, tuple, Re

  • 将返回的数据jsonify一下,问题就解决了

将返回的数据jsonify一下,问题就解决了

@app.route("/ner",methods=['POST'])
def NER():
    if request.method == 'POST':
        json_data = request.get_json()
        question = json_data['question']
        res=predict(question)
        return jsonify(res)

你可能感兴趣的:(Flask,flask,python,后端)