keras-flask-deploy-webapp

授权协议 GPL-3.0 License
开发语言 Python
所属分类 神经网络/人工智能、 机器学习/深度学习
软件类型 开源软件
地区 不详
投 递 者 乐正翰
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Deploy Keras Model with Flask as Web App in 10 Minutes

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 https://github.com/mtobeiyf/keras-flask-deploy-webapp.git
$ 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 https://github.com/mtobeiyf/keras-flask-deploy-webapp.git
$ cd keras-flask-deploy-webapp

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

# 3. Run!
$ python app.py

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


Customization

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

Details

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.

Deployment

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

Details

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

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

Future Plan

  • Support detection and segmentation models

More Resources

Building a simple Keras + deep learning REST API

 相关资料
  • This section focuses on deploying real-world models. It contains the following documents: @{$distributed$Distributed TensorFlow}, which explains how to create a cluster of TensorFlow servers. @{$tfser

  • 该系统主要用于PHP代码的发布和回滚,主要业务对象为项目和机器。项目关联服务器,针对项目进行版本发布,针对Git仓库的TAG进行回滚,目前仅支持全量发布和回滚, 不支持单文件的发布。 该系统可部署在单独的服务器上,但消息worker端必须与Git仓库部署在一起 使用的python扩展如下: angularjs tornado oslo.config sqlalchemy python-mysql

  • Apache::Deploy 是一个 (R)?ex 的模块,用来快速发布网站到 Apache 和 WAR 文件到 Tomcat. 简化了多服务器应用的发布过程。 一段发布应用到 Tomcat 的脚本: use Rex::Apache::Deploy Tomcat;# Version of the applicationmy $VERSION = "1.0";user "deploy";public

  • go-deploy web集群一键上线工具,支持SVN、Git。增量更新、回滚,100+服务器节点秒级完成部署。 Screenshot 特性 支持svn和git 支持多项目、多节点、多环境、分布式集群环境批量更新和回滚操作 golang的高性能并发加持,上百台节点秒级完成部署 无需svn或git账号密码、无需免密登录目标机 降低安全风险 增量更新、回滚,速度更快 server和client采用tc

  • deploy-robot 是 SegmentFault 出品的 Github 自动部署机器人,将你从繁冗的部署工作中解放出来,让你的部署流程更加自动化。 特点: 与 GitHub 深度整合,利用 GitHub API 读取相关部署指令,并及时反馈部署情况 与人工部署不同的是,自动部署不会疲劳,也不会喊累,你永远可以不停地折腾它 使用方法 执行以下命令安装 npm install -g deploy

  • vs-deploy Visual Studio Code (VS Code) extension that provides commands to deploy files of a workspace to a destination. The extension supports the following destination types: Type Supports download