Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: u'key' #10

Open
terryKing1992 opened this issue Dec 15, 2016 · 3 comments
Open

KeyError: u'key' #10

terryKing1992 opened this issue Dec 15, 2016 · 3 comments

Comments

@terryKing1992
Copy link

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~

@tobegit3hub
Copy link
Owner

Can you provide the error log about this?

@terryKing1992
Copy link
Author

terryKing1992 commented Dec 15, 2016

@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

@tobegit3hub
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants