File size: 554 Bytes
8f95203
 
 
 
a208425
 
 
5d9a162
43ea5e5
8f95203
 
 
 
 
a208425
 
 
 
 
5d9a162
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
FROM python:3.10-slim

WORKDIR /app

ENV HF_HOME=/data/hf_cache
ENV HF_DATASETS_CACHE=/data/hf_cache

RUN mkdir -p /data/hf_cache && chmod -R 777 /data/hf_cache

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

RUN python - <<'PY'
from transformers import T5Tokenizer, T5ForConditionalGeneration
T5Tokenizer.from_pretrained("t5-small", cache_dir="/data/hf_cache")
T5ForConditionalGeneration.from_pretrained("t5-small", cache_dir="/data/hf_cache")
PY

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]