0

我正在调用 BlueData MLOPS 预测 API 来获得我的模型的分数,但我得到了以下响应:

============================response begin==========================================
Status code  : {}200
Status text  : {}OK
Headers      : {}{Server=[gunicorn/19.9.0], Date=[Sat, 23 Nov 2019 12:16:43 GMT], Content-Type=[text/html; charset=utf-8], Content-Length=[50]}
Response body: {}'NoneType' object does not support item assignment
=======================response end=================================================

这可能是什么原因造成的?

4

1 回答 1

0

在仔细检查我的请求后,我注意到我将内容类型设置为text/plain

===========================request begin================================================
URI         : {}http://xxxx:10026/diabetes%20model/1/predict
Method      : {}POST
Headers     : {}{Accept=[application/json], X-Auth-Token=[6EMbYcQsBD], Content-Type=[text/plain;charset=ISO-8859-1], Content-Length=[174], Accept-Charset=[big5, ...]}
Request body: {}{"use_scoring": true, "scoring_args": {"NumPreg":1.0,"Glucose": 85.0,"BloodPressure": 66.0,"SkinThick": 29.0,"Insulin": 0.0,"BMI": 26.6,"DiabetesPedFunc": 0.351,"Age": 35.0}}
==========================request end===================================================

改变它application/json为我解决了这个问题。

于 2019-11-23T12:20:12.900 回答