feat: init

This commit is contained in:
orion 2023-09-23 15:10:35 -05:00
parent 0f291c762e
commit 919605f39c
Signed by: orion
GPG Key ID: 6D4165AE4C928719
4 changed files with 10 additions and 21 deletions

View File

@ -1,2 +1,3 @@
.env .env
env model
__pycache__

View File

@ -1 +1 @@
python 3.10.13 python 3.11.5

View File

@ -1,23 +1,10 @@
FROM python:3.10-bookworm AS base FROM git.orionkindel.com/tpl/asdf:bookworm
FROM base AS tini COPY .tool-versions ./
RUN asdf install
ENV TINI_VERSION v0.19.0 COPY requirements.txt ./
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
FROM tini AS tools
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
export DEBIAN_FRONTEND=noninteractive \
&& apt-get update -y \
&& apt-get upgrade -y
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
FROM tools AS api COPY ./ ./
CMD ["python", "./"]
COPY . .
CMD ["python", "."]

View File

@ -16,6 +16,7 @@ model = T5ForConditionalGeneration.from_pretrained(
load_dotenv() load_dotenv()
api_keys = getenv('API_KEYS').split(sep=",") api_keys = getenv('API_KEYS').split(sep=",")
port = getenv('PORT') or 9010
generator = pipeline("text2text-generation", model=model, tokenizer=tokenizer) generator = pipeline("text2text-generation", model=model, tokenizer=tokenizer)