|
|
|
FROM python:3.9-slim |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
COPY requirements.txt . |
|
|
|
|
|
RUN mkdir -p /cache/huggingface /cache/matplotlib \ |
|
&& chmod -R 777 /cache/huggingface /cache/matplotlib |
|
|
|
|
|
ENV HF_HOME=/cache/huggingface |
|
ENV MPLCONFIGDIR=/cache/matplotlib |
|
|
|
|
|
ENV FLASK_APP=app.py |
|
|
|
|
|
RUN pip install --no-cache-dir -r requirements.txt |
|
|
|
RUN "from transformers import AutoModelForCausalLM, AutoTokenizer; AutoModelForCausalLM.from_pretrained('gpt2-xl', cache_dir='/cache/huggingface'); AutoTokenizer.from_pretrained('gpt2-xl', cache_dir='/cache/huggingface')" |
|
|
|
|
|
COPY . . |
|
|
|
|
|
EXPOSE 7860 |
|
|
|
|
|
CMD ["flask", "run", "--host=0.0.0.0", "--port=7860"] |