Git Product home page Git Product logo

imfing / keras-flask-deploy-webapp Goto Github PK

View Code? Open in Web Editor NEW
1.2K 30.0 476.0 101 KB

:smiley_cat: 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.

License: Apache License 2.0

Python 24.41% CSS 21.71% JavaScript 29.15% HTML 23.00% Dockerfile 1.72%
keras tensorflow flask deployment webapp deep-learning pre-trained

keras-flask-deploy-webapp's Introduction

Deploy Keras Model with Flask as Web App in 10 Minutes

Contributions Welcome

A minimal and customizable repo to deploy your image models as web app easily.

Getting Started

  • Quick run with Docker:
    docker run --rm -p 5000:5000 ghcr.io/imfing/keras-flask-deploy-webapp:latest
  • Go to http://localhost:5000 and enjoy ๐ŸŽ‰

Screenshot:

New Features ๐Ÿ”ฅ

  • Enhanced, mobile-friendly UI
  • Support image drag-and-drop
  • Use vanilla JavaScript, HTML and CSS. No jQuery or Bootstrap
  • Switch to TensorFlow 2.x and tf.keras by default
  • Upgrade Docker base image to Python 3.11


Run with Docker

Use prebuilt image

$ docker run --rm -p 5000:5000 ghcr.io/imfing/keras-flask-deploy-webapp:latest

Build locally

With Docker, you can quickly build and run the entire application in minutes ๐Ÿณ

# 1. First, clone the repo
$ git clone https://github.com/imfing/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/imfing/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.

Note Also consider gradio or streamlit to create complicated web apps for ML models.

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.

More Resources

Building a simple Keras + deep learning REST API

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.