Closed gitknu closed 1 year ago
did you install and run using docker
?
yes, certainly
here is the info that everything is built correctly, for more details:
sudo docker build -t keras_flask_app .
And then:
Sending build context to Docker daemon 2.631MB Step 1/7 : FROM tensorflow/tensorflow:2.5.1 ---> 792f5d09073d Step 2/7 : COPY requirements.txt / ---> Using cache ---> 0d566a95961a Step 3/7 : RUN python3 -m pip install -r /requirements.txt ---> Using cache ---> 0463dc22fa42 Step 4/7 : COPY . /app ---> 2ef48ef0d485 Step 5/7 : WORKDIR /app ---> Running in 573fdc35a32e Removing intermediate container 573fdc35a32e ---> be21426154ab Step 6/7 : EXPOSE 5000 ---> Running in d1753652bc51 Removing intermediate container d1753652bc51 ---> 85cf62945640 Step 7/7 : CMD [ "python" , "app.py"] ---> Running in bb5553c661b5 Removing intermediate container bb5553c661b5 ---> 98795701476a Successfully built 98795701476a Successfully tagged keras_flask_app:latest
Just after this command it freezes for 1-3 seconds, and then exits without any errors: docker run -it --rm -p 5000:5000 keras_flask_app
Firstly I was sure that was because of empty Models folder (logically, no model - nothing to test, that's why no UI even didn't start, but even with h5 file and labels.txt - the same thing (exits))
after the container image is successfully built, can you try run with:
docker run -it --rm -p 5000:5000 --entrypoint /bin/bash keras_flask_app
which should give you a shell, and from there, try to run python3 app.py
and see what error it complains
Thank you. I've tried. it says: Illegal instruction (core dumped)
Confirmed this is broken as shown in the readme. It would be nice to have an updated version that works as shown, otherwise it might be prudent to archive the repository.
$ docker run -it --rm -p 5000:5000 keras_flask_app
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
2023-05-09 00:51:43.870983: F tensorflow/core/lib/monitoring/sampler.cc:42] Check failed: bucket_limits_[i] > bucket_limits_[i - 1] (0 vs. 10)
qemu: uncaught target signal 6 (Aborted) - core dumped
Using: MacOS 13.3.1, Docker version 20.10.23, build 7155243.
@Gituseron @brsolomon-deloitte Thank you for the feedback, I can reproduce this issue and I think the main reason might be the Docker image being too old and packages outdated. I will update the Dockerfile to resolve it, and provide prebuilt images.
In my case, it was actually because Tensorflow does not distribute Docker images (nor is underlying tensorflow supported on) MacOS M1 ARM chips. It may very well be that there is no issue with this app on amd64.
yeah, since the docker base image was fairly old which is amd64 only, and plus the tensorflow package is outdated without prebuilt wheel for Arm architecture. I've fixed the Dockerfile in #64 which should address this issue.
@Gituseron @brsolomon-deloitte I've built and published prebuilt images (for both amd64 and arm64) to GitHub container registry, see Package keras-flask-deploy-webapp Now instead of building images on your own, you can:
$ docker run --rm -p 5000:5000 ghcr.io/imfing/keras-flask-deploy-webapp:v0.1.1
which should work out-of-box on M1 macbook
@imfing awesome, thank you!
Thank you for your quick responses and all the edits done today! I have tried new docker right now, but the problem is it quits just after the start. I tried building docker both with model in folder Models (exactly I used h5 model from teachable machine by google) and without it, but nevertheless - simply exits. As for local install:
Even though it is installed within requirements.txt