- Working on automating deployment like
gunicorn
- 2019/11/15, deploy this web app on the Langone server, which supports the access via ssh tunnel
- 2019/11/11, finish basic detector and classifier pipeline
- Clone this repo
- Install requirements
- Run the script
- Check http://localhost:5001
- Done! 🎉
- Login the server IP address:
10.189.38.45
- Git clone this repo, and run the app by
python app.py
(on the server) - open a tunnel by the following command (on your local machine)
ssh -N -L 5001:127.0.0.1:5001 bz1030@10.189.38.45
- Open the browser and put
localhost:5001
to see this app(on your local machine)
$ git clone https://github.com/mtobeiyf/keras-flask-deploy-webapp.git
$ pip install -r requirements.txt
Make sure you have the following installed:
- torch =======
- flask
- pillow
- h5py
- gevent
- torch
Python 3.5+ is supported and tested.
$ python app.py
Open http://localhost:5001 and have fun. 😃. Port will be configured inside app.py
.
Place your trained .h5
file saved by torch.save()
under models directory.
Check out torchvision
for other pre-trained model.
Modify files in templates
and static
directory.
index.html
for the UI and main.js
for all the behaviors
To deploy it for public use, you need to have a public linux server.
Run the script and hide it in background with tmux
or screen
.
$ python app.py
You can also use gunicorn instead of gevent
$ gunicorn -b 127.0.0.1:5001 app:app
$ gunicorn -b 127.0.0.1:5001 app:app --log-level=debug --timeout=5
More deployment options, check here
To redirect the traffic to your local app.
Configure your Nginx .conf
file.
server {
listen 80;
client_max_body_size 20M;
location / {
proxy_pass http://127.0.0.1:5000;
}
}
Check Siraj's "How to Deploy a Keras Model to Production" video. The corresponding repo.