Coder Social home page Coder Social logo

KeyError: 'image' about androidflask HOT 5 CLOSED

ahmedfgad avatar ahmedfgad commented on July 20, 2024
KeyError: 'image'

from androidflask.

Comments (5)

rsingh2083 avatar rsingh2083 commented on July 20, 2024 2

Solved it by downgrading h5py to 2.10.0

from androidflask.

ahmedfgad avatar ahmedfgad commented on July 20, 2024

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.

from androidflask.

rsingh2083 avatar rsingh2083 commented on July 20, 2024

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
img = img.reshape(784)
ValueError: cannot reshape array of size 2332800 into shape (784,)

from androidflask.

ahmedfgad avatar ahmedfgad commented on July 20, 2024

Note that the project expects a MNIST image of shape 28x28. I think you selected an image of different shape.

from androidflask.

rsingh2083 avatar rsingh2083 commented on July 20, 2024

Thanks Ahmad I tried copying the mnist example images in screenshot directory only then I was able to upload them.
But now getting this different error :-)

File "/home/ubuntu/Downloads/AndroidFlask-master/Part 2/FlaskServer/flask_server.py", line 18, in handle_request
loaded_model = keras.models.load_model('model.h5')
File "/home/ubuntu/.local/lib/python3.6/site-packages/keras/models.py", line 269, in load_model
model_config = json.loads(model_config.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'

from androidflask.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.