我得到了下面的ERROR消息:- 'The view function did not return a valid response. The'TypeError: The view function did not return a valid response. "类型错误:视图函数没有返回一个有效的响应。该函数要么返回None,要么没有返回语句就结束了。
我的代码是:-''' app = Flask(名称)
@app.route("/input", methods=['GET'])
def get_input():
if request.method == 'GET':
request_data = request.args.get('sentence')
sentence = request_data
print(sentence)
sentence_token = sentence.split()
sentence_clean = remove_noise(sentence_token)
print(type(sentence_token))
print(sentence_token)
print(sentence_clean)
def feature(sentence_clean):
return dict([token,True] for token in sentence_clean)
output = classifier.classify(feature(sentence_clean))
Response(output,Status=200)
else:
Response("METHOD NOT ALLOWED",Status=405)
如果 名称=='主': app.run(host="127.0.0.1", port=5000)'''。
什么给:print(type(output))?你的问题有不好的缩进,检查你的作用域。