AI模型微服务部署与机器学习开发生命周期
1. 以容器形式打包应用
1.1 填充依赖文件
要构建一个包含AI模型的Docker容器,首先需明确容器构建时要安装的依赖项。将这些依赖写入 requirements.txt 文件,示例如下:
Flask==1.0.2
tensorflow==1.9.0
Keras==2.1.6
建议使用测试过的库版本,避免意外情况。可通过 pip freeze 命令查看已安装库的当前版本。
1.2 编写Dockerfile
在与 app.py 文件相同的文件夹中创建 Dockerfile ,其内容如下:
# Docker file for simple NLP app
# Author: Dattaraj J Rao
# For Book: Keras2Kubernetes
# Start with latest Ubuntu image
FROM ubuntu:latest
# Install latest updates
RUN apt-get update -y
# Install Python and build libraries
RUN apt-get install -y python-pip python-dev build-essential
# Copy all files from c
超级会员免费看
订阅专栏 解锁全文
726

被折叠的 条评论
为什么被折叠?



