bofei5675 / KneeApp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Knee Web App

GPLv3 license

Update

  • 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

Getting started in 10 minutes(local)

Getting start on the server (will change to a better way later)

  • 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)

Local Installation

Clone the repo

$ git clone https://github.com/mtobeiyf/keras-flask-deploy-webapp.git

Install requirements

$ pip install -r requirements.txt

Make sure you have the following installed:

  • torch =======
  • flask
  • pillow
  • h5py
  • gevent
  • torch

Run with Python

Python 3.5+ is supported and tested.

$ python app.py

Play

Open http://localhost:5001 and have fun. 😃. Port will be configured inside app.py.


Customization

Use your own model

Place your trained .h5 file saved by torch.save() under models directory.

Use other pre-trained model

Check out torchvision for other pre-trained model.

UI Modification

Modify files in templates and static directory.

index.html for the UI and main.js for all the behaviors

Deployment

To deploy it for public use, you need to have a public linux server.

Run the app

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

Set up Nginx

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;
    }
}

More resources

Check Siraj's "How to Deploy a Keras Model to Production" video. The corresponding repo.

Building a simple Keras + deep learning REST API

Gunicorn with Flask App

About

License:GNU General Public License v3.0


Languages

Language:Python 78.0%Language:JavaScript 9.2%Language:HTML 6.6%Language:CSS 2.9%Language:Shell 2.8%Language:Dockerfile 0.6%