11# Deploy an Machine Learning Service Quickly on Fargate using Streamlit and AWS Copilot
22
33This repository shows show to rapidly deploy a Machine Learning ML service on Amazon Web Services (AWS) Cloud, using AWS Fargate and Streamlit.
4- The primary of focus of this exampale is how to get an ML service up and running quickly on AWS.
4+ The primary of focus of this example is how to get an ML service up and running quickly on AWS.
55For reference, you will create a text summarization application service using the Hugging Face Transformers library.
66
77
88
99![ alt text] ( diagram/textsumapp.png " Text Sum App ")
1010
1111* Machine Learning as Service
12- * Automated backend and deploy using the command line and AWS sercies
12+ * Automated backend and deploy using the command line and AWS services
1313* Automated fronted using AWS Fargate and Steamlit
1414
1515## Deploy using AWS Copilot
@@ -19,7 +19,7 @@ See the [docs](https://github.com/aws/copilot-cli)
1919
2020You can initialize the app and configure the resource requirements in the copilot application manifest.yml file by using following steps:
2121
22- 1 . Set up the application and enviroment details.
22+ 1 . Set up the application and environment details.
2323Execute below commands from the application home directory. Copilot prompts you through the set up of your application.
2424```
2525copilot init
@@ -67,24 +67,25 @@ To run locally inside of the virtual environment:
6767` streamlit run streamlit-ui/main.py --logger.level=debug `
6868
6969
70- If you want to buidl the image and run in locally.
70+ If you want to build the image and run in locally.
7171```
72- docker build -t aws- summarizer:latest . --platform=linux/amd64
72+ docker build -t summarizer:latest . --platform=linux/amd64
7373
74- docker run -it -p 8501:8501 aws- summarizer:latest
74+ docker run -it -p 8501:8501 summarizer:latest
7575```
7676
7777### Pushing to ECR
7878
7979```
80+ REGION=$(aws configure get profile.default.region)
8081AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query 'Account' --output text)
81- aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${AWS_ACCOUNT_ID}.dkr.ecr.us-east-1 .amazonaws.com
82+ aws ecr get-login-password --region ${REGION} | docker login --username AWS --password-stdin ${AWS_ACCOUNT_ID}.dkr.ecr.${REGION} .amazonaws.com
8283
83- docker build -t aws- summarizer . --platform=linux/amd64
84+ docker build -t summarizer . --platform=linux/amd64
8485
85- docker tag aws- summarizer:latest ${AWS_ACCOUNT_ID}.dkr.ecr.us-east-1 .amazonaws.com/aws- summarizer:latest
86+ docker tag summarizer:latest ${AWS_ACCOUNT_ID}.dkr.ecr.${REGION} .amazonaws.com/summarizer:latest
8687
87- docker push ${AWS_ACCOUNT_ID}.dkr.ecr.us-east-1 .amazonaws.com/aws- summarizer:latest
88+ docker push ${AWS_ACCOUNT_ID}.dkr.ecr.${REGION} .amazonaws.com/summarizer:latest
8889```
8990
9091Build out copilit using the local image name
@@ -94,17 +95,10 @@ May need to actually select local image name to build from
9495copilot init --app text-sum \
9596 --name text-sum-api \
9697 --type 'Load Balanced Web Service' \
97- —-image aws- summarizer \
98+ —-image summarizer \
9899 --deploy
99100```
100101
101- ```
102- copilot init --app text-sum \
103- --name text-sum-api \
104- --type 'Load Balanced Web Service' \
105- —-image aws-summarizer \
106- --deploy
107- ```
108102
109103
110104# References
0 commit comments