KeyError: u'key'
terryKing1992 opened this issue · 3 comments
when i send post request to /cancer_predict/predict/, occur error like this:File "/Users/terry/Downloads/deep_recommend_system-master/http_service/cancer_predict/views.py", line 38, in predict feed_dict[v] = np.array(examples[k])
i print examples
value:{u'features': u'10,10,10,8,6,1,8,9,1;6,2,1,1,1,1,7,1,1'}
and (k, v) value k:features, v:Placeholder:0
;
how can i fix the error, thanks for help~
Can you provide the error log about this?
@tobegit3hub thanks for help , the error log as follow:
Internal Server Error: /cancer_predict/predict/ Traceback (most recent call last): File "/Library/Python/2.7/site-packages/django/core/handlers/exception.py", line 39, in inner response = get_response(request) File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response response = self._get_response(request) File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request) File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/Library/Python/2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view return view_func(*args, **kwargs) File "/Users/terry/Downloads/deep_recommend_system-master/http_service/cancer_predict/views.py", line 64, in predict result = predict_service.predict(body) File "/Users/terry/Downloads/deep_recommend_system-master/http_service/cancer_predict/views.py", line 38, in predict feed_dict[v] = np.array(examples[k]) KeyError: u'key' [15/Dec/2016 01:36:50] "POST /cancer_predict/predict/ HTTP/1.1" 500 76363
I think we have changed key
to keys
when exporting the model. You can try modify the code and see if it's solved.
By the way, I recommend you to use the high-performance gRPC service instead of the HTTP service.