14.04.2018       Выпуск 225 (09.04.2018 - 15.04.2018)       Интересные проекты, инструменты, библиотеки

keras-flask-deploy-webapp - разворачиваем Keras модель с помощью Flask


Экспериментальная функция:

Ниже вы видите текст статьи по ссылке. По нему можно быстро понять ссылка достойна прочтения или нет

Просим обратить внимание, что текст по ссылке и здесь может не совпадать.


Deploy Keras Model with Flask as Web App in 10 Minutes

GPLv3 license

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

Getting started in 10 minutes



Clone the repo

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

Install requirements

Make sure you have the following installed:

Run with Python

Python 2.7 or 3.5+ are supported and tested.


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


Use your own model

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

Check the commented code in app.py.

Use other pre-trained model

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

Check this section in app.py.

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 app.py

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

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

Лучшая Python рассылка

Разместим вашу рекламу

Пиши: mail@pythondigest.ru

Нашли опечатку?

Выделите фрагмент и отправьте нажатием Ctrl+Enter.

Система Orphus