Closed kraigrs closed 6 years ago
It looks like there may be a problem decoding the image. I'm not sure what may be causing that problem but you'll likely want to ensure the image can be loaded via Keras' load_img
function locally. If it can be loaded locally, then there is an encoding/decoding issue that you may need to debug further.
load_img
works as expected (which is what I was afraid of), still very peculiar that it runs fine from cURL but not using requests
.
I'll get back to debugging and let you know what, if anything, works.
Hm, unfortunately I'm not sure what the issue may be then. I have two other tutorials on building a Keras API available here:
My only guess is that it could be related to C-contiguous ordering, but outside of that, I'm unfortunately not sure what the root cause is. Sorry I couldn't be of more help here!
I figured out the issue. Because of certain web services we were accessing that wouldn't allow a proxy to be specified, I edited the requests
library to use our corporate proxies by default. When I turned this off, it magically worked, so going through our proxy seemed to be messing up the encoding/decoding for the image being posted. I would call this resolved, thank you for creating these resources!
Awesome, congrats on resolving the issue Kraig!
@kraigrs could you say how exactly you fixed the problem?
Thanks
@hasibzunair I had originally edited the source code in the requests
library to reflect corporate proxy rules, and when I returned them to their default, it worked. If you haven't made such changes to requests
, I don't suspect that would be the problem.
I'm having some trouble using
requests
to programatically call the REST API. Submitting the request via cURL works without issues, but when I attempt to run the same image through simple_request.py, I receive the following error:When I run the script without
.json()
at the end of the request, it returns a very strange HTML response that I can't make heads or tails of.I am on a Windows 10 machine (corporate environment), Python 3.6.1, Keras v2.0.8, TensorFlow v1.3.0, requests v2.14.2
Any help with this would be greatly appreciated!