bluedata mlops预测-'NoneType'对象不支持项目分配

时间:2019-11-23 12:20:12

标签: bluedata mlops

我正在调用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=================================================

可能是什么原因造成的?

1 个答案:

答案 0 :(得分: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可以解决我的问题。