anmoljagetia / oreilly-ai-pokemon-webapp

This repo contains the code for webapp hosted at https://pokedex.anmoljagetia.me demoed at the O'Reilly AI Conf in London

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

O'Reilly AI Pokemon Webapp

This repo contains the code for webapp hosted at https://pokedex.anmoljagetia.me demoed at the O'Reilly AI Conf, 2018 in London.


Getting started in 10 minutes


Docker Installation

Build the image

cd keras-flask-deploy-webapp
docker build -t keras_flask .
docker run -p 5000:5000

You can mount your model into the container.

docker run -e MODEL_PATH=/mnt/models/your_model.h5  -v volume-name:/mnt/models -p 5000:5000 keras_flask

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:

  • tensorflow
  • keras
  • flask
  • pillow
  • h5py
  • gevent

Run with Python

Python 2.7 or 3.5+ are supported and tested.

$ python app.py

Play

Open http://localhost:5000 and have fun. 😃


Customization

Use your own model

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

Use other pre-trained model

See Keras applications for more available models such as DenseNet, MobilNet, NASNet, etc.

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:5000 app:app

More deployment options, check here

Set up Nginx as Reverse Proxy

Look at the nginx.conf file in the repo.

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

About

This repo contains the code for webapp hosted at https://pokedex.anmoljagetia.me demoed at the O'Reilly AI Conf in London

License:MIT License


Languages

Language:HTML 54.6%Language:Python 30.6%Language:JavaScript 8.0%Language:CSS 4.9%Language:Dockerfile 2.0%