Skip to content
Switch branches/tags


Failed to load latest commit information.
Latest commit message
Commit time

Deploy Keras Model with Flask as Web App in 10 Minutes

GPLv3 license Contributions Welcome

A pretty and customizable web app to deploy your DL model with ease

Buy Me A Coffee

Getting Started in 10 Minutes

👇 Screenshot:

New Features 🔥

  • Enhanced, mobile-friendly UI
  • Support image drag-and-drop
  • Use vanilla JavaScript, HTML and CSS. Remove jQuery and Bootstrap
  • Switch to TensorFlow 2.0 and tf.keras by default
  • Upgrade Docker base image to Python 3 (it's 2020)

If you need to use Python 2.x or TensorFlow 1.x, check out the legacy snapshot

Run with Docker

With Docker, you can quickly build and run the entire application in minutes 🐳

# 1. First, clone the repo
$ git clone
$ cd keras-flask-deploy-webapp

# 2. Build Docker image
$ docker build -t keras_flask_app .

# 3. Run!
$ docker run -it --rm -p 5000:5000 keras_flask_app

Open http://localhost:5000 and wait till the webpage is loaded.

Local Installation

It's easy to install and run it on your computer.

# 1. First, clone the repo
$ git clone
$ cd keras-flask-deploy-webapp

# 2. Install Python packages
$ pip install -r requirements.txt

# 3. Run!
$ python

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


It's also easy to customize and include your models in this app.


Use your own model

Place your trained .h5 file saved by under models directory.

Check the commented code in

Use other pre-trained model

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

Check this section in

UI Modification

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 app

Run the script and hide it in background with tmux or screen.

$ python

You can also use gunicorn instead of gevent

$ gunicorn -b app:app

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 / {

Future Plan

  • Support detection and segmentation models

More Resources

Building a simple Keras + deep learning REST API


😺 Pretty & simple image classifier app template. Deploy your own trained model or pre-trained model (VGG, ResNet, Densenet) to a web app using Flask in 10 minutes.





No packages published