app.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:mnist-flask 作者: akashdeepjassal 项目源码 文件源码
def predict():
    # get data from drawing canvas and save as image
    parseImage(request.get_data())

    # read parsed image back in 8-bit, black and white mode (L)
    x = imread('output.png', mode='L')
    x = np.invert(x)
    x = imresize(x,(28,28))

    # reshape image data for use in neural network
    x = x.reshape(1,28,28,1)
    with graph.as_default():
        out = model.predict(x)
        print(out)
        print(np.argmax(out, axis=1))
        response = np.array_str(np.argmax(out, axis=1))
        return response
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号