Skip to content

Latest commit

 

History

History
67 lines (46 loc) · 1.57 KB

README.md

File metadata and controls

67 lines (46 loc) · 1.57 KB

API

# https://stackoverflow.com/questions/59882884/vscode-doesnt-show-poetry-virtualenvs-in-select-interpreter-option

poetry config virtualenvs.in-project true

# shows the name of the current environment
poetry env list

poetry install

Getting Started

To start the api:

# Regular model
poetry run uvicorn chinese_translation_api.server:app --workers 1 --reload --port=5001

# Quantized
MODEL_TYPE=quantized_dynamic poetry run uvicorn chinese_translation_api.server:app --workers 1 --reload --port=5001

# Server-Only for Load Testing
MODEL_TYPE=quantized_dynamic DEPLOY_TYPE=server poetry run uvicorn chinese_translation_api.server:app --workers 1 --reload --port=5001

Build and Push to ECR

poetry export -f requirements.txt --output requirements.txt

Build docker:

docker build -t chinese-translation-api .

Push to ECR:

# authenticate
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/h1c6y7g8

# tag as latest and push
# Remember to increment the version
API_VERSION="v0.0.4"
PUSH_REPO="public.ecr.aws/h1c6y7g8/chinese-translation-api:${API_VERSION}"
docker tag chinese-translation-api:latest $PUSH_REPO
docker push $PUSH_REPO

Run the docker image as container:

# regular
docker run -d --name translation_server_container -p 5001:5001 chinese-translation-api

# with env
docker run -e ENV_TYPE="production" -e DEPLOY_TYPE="server" --name translation_server_container_deploy -p 5001:5001 -d chinese-translation-api

Docker Releases

  • v0.0.1: Basic.