-
-
Notifications
You must be signed in to change notification settings - Fork 30
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: 'image' #3
Comments
Hi, You are right. A quick solution is to edit the next line from the flask_server.py script (https://github.com/ahmedfgad/AndroidFlask/blob/master/Part%202/FlaskServer/flask_server.py): imagefile = flask.request.files['image'] The new line should use image0 rather than image as the key. imagefile = flask.request.files['image0'] This will allow you to upload only a single image from the client to the server. I will update the project later to support multiplt image upload. Please let me know if there still any issue. |
Thanks a lot buddy. Now im getting this error. I selected a different Image from my mobile. The images which you have provided for the digits are not getting selected for uplaod and I get the error - "Something went wrong"..Hence I tried with a random image, but then getting this error File "/home/ubuntu/Downloads/AndroidFlask-master/Part 2/FlaskServer/flask_server.py", line 17, in handle_request |
Note that the project expects a MNIST image of shape 28x28. I think you selected an image of different shape. |
Thanks Ahmad I tried copying the mnist example images in screenshot directory only then I was able to upload them. File "/home/ubuntu/Downloads/AndroidFlask-master/Part 2/FlaskServer/flask_server.py", line 18, in handle_request |
Solved it by downgrading h5py to 2.10.0 |
While uploading the image from mobile im getting this error. I even tried using 4.9.0 version of okhttp but still the same error.
192.168.31.250 - - [07/Dec/2020 16:08:55] "POST / HTTP/1.1" 500 -
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.6/site-packages/flask/app.py", line 2464, in call
return self.wsgi_app(environ, start_response)
File "/home/ubuntu/.local/lib/python3.6/site-packages/flask/app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "/home/ubuntu/.local/lib/python3.6/site-packages/flask/app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/ubuntu/.local/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/ubuntu/.local/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/home/ubuntu/.local/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/ubuntu/.local/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/ubuntu/.local/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/ubuntu/.local/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/home/ubuntu/.local/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/ubuntu/Downloads/AndroidFlask-master/Part 2/FlaskServer/flask_server.py", line 11, in handle_request
imagefile = flask.request.files['image']
File "/home/ubuntu/.local/lib/python3.6/site-packages/werkzeug/datastructures.py", line 442, in getitem
raise exceptions.BadRequestKeyError(key)
werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
KeyError: 'image'
File "/home/raghavz/.local/lib/python3.6/site-packages/werkzeug/datastructures.py", line 442, in getitem
raise exceptions.BadRequestKeyError(key)
werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
KeyError: 'image'
The text was updated successfully, but these errors were encountered: