# Train and Deploy Machine Learning Model With Web Interface - Docker, PyTorch & Flask
Live access (deployed on GCP): https://ml-app.imadelhanafi.com
![alt text](https://imadelhanafi.com/data/draft/capture_app_elhanafi.gif)
---
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
- Training and saving the CNN model : https://gist.github.com/imadelh/b337c7b16899831d80d9221a9a60e09f
- Visualize the inference : https://colab.research.google.com/github/imadelh/ML-web-app/blob/master/Notebooks/emnist_inference_cnn-2.ipynb
## 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
没有合适的资源?快使用搜索试试~ 我知道了~
Python-使用Web界面训练和部署机器学习模型采用DockerPyTorch和Flask实现
共18个文件
py:5个
pyc:3个
pth:2个
1星 需积分: 36 93 下载量 51 浏览量
2019-08-11
03:04:21
上传
评论 13
收藏 19.61MB ZIP 举报
温馨提示
使用Web界面训练和部署机器学习模型 - 采用Docker,PyTorch和Flask实现
资源推荐
资源详情
资源评论
收起资源包目录
Python-使用Web界面训练和部署机器学习模型采用DockerPyTorch和Flask实现.zip (18个子文件)
ML-web-app-master
Dockerfile 414B
app
app.py 1KB
ml_model
old_models_weights
trained_weights_v1.pth 10.58MB
model.py 2KB
__pycache__
model.cpython-35.pyc 2KB
__init__.cpython-35.pyc 108B
network.cpython-35.pyc 1KB
__init__.py 0B
trained_weights.pth 10.58MB
network.py 1KB
static
index.js 3KB
style.css 432B
templates
home.html 3KB
readme.md 2KB
Dockerfile-jetson 3KB
requirements.txt 181B
Notebooks
training_cnn.py 5KB
emnist_inference_cnn-2.ipynb 14KB
共 18 条
- 1
资源评论
- 漠北尘-Gavin2020-09-10太不厚道了,抄袭别人的开源代码赚C币,好要那么多C币,开源链接:https://github.com/imadelh/ML-web-app
weixin_39841848
- 粉丝: 509
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功