Code Monkey home page Code Monkey logo

ml-web-app's Introduction

Train and Deploy Machine Learning Model With Web Interface - Docker, PyTorch & Flask

Live access (deployed on GCP): https://ml-app.imadelhanafi.com

alt text


Blog post: https://imadelhanafi.com/posts/train_deploy_ml_model/

This repo contains code associated with the above blog post.

Running on Local/cloud machine

Clone the repo and build the docker image

sudo docker build -t flaskml .

Then after that you can run the container while specefying the absolute path to the app

sudo docker run -i -t --rm -p 8888:8888 -v **absolute path to app directory**:/app flaskml

This will run the application on localhost:8888

You can use serveo.net or Ngrok to port the application to the web.

Running on Jetson-Nano

On Jetson-nano, to avoid long running time to build the image, you can download it from Docker Hub. We will also use a costumized Docker command https://gist.github.com/imadelh/cf7b12c9cc81c3cb95ad2c6bc747ccd0 to be able to access the GPU of the device on the container.

docker pull imadelh/jetson_pytorch_flask:arm_v1

Then on your device you can access the bash (this the default command on that image)

sudo ./mydocker.sh run -i -t --rm -v /home/imad:/home/root/ imadelh/jetson_pytorch_flask:arm_v1

and then simply get to the application directory and run it

cd app
python3 app.py

Useful files

Info

This a generic web app for ML models. You can update your the network and weights by changing the following files.

app/ml_model/network.py
app/ml_model/trained_weights.pth

Imad El Hanafi

ml-web-app's People

Contributors

imadelh avatar

Watchers

James Cloos avatar

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.