# 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
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
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
v0.0.1
: Basic.