|
FROM python:3.10-slim |
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 |
|
ENV PYTHONUNBUFFERED=1 |
|
ENV DEBIAN_FRONTEND=noninteractive |
|
ENV MODEL_PATH=RufusRubin777/GOT-OCR2_0_CPU |
|
|
|
WORKDIR /app |
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
build-essential \ |
|
libpq-dev \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
COPY requirements.txt . |
|
RUN pip install --no-cache-dir -r requirements.txt |
|
|
|
|
|
RUN mkdir -p /root/.cache/huggingface |
|
VOLUME /root/.cache/huggingface |
|
|
|
|
|
RUN python -c "from transformers_modules.RufusRubin777.GOT_OCR2_0_CPU.modeling_GOT import GOTModel, GOTConfig; \ |
|
from transformers import AutoTokenizer; \ |
|
model_path='RufusRubin777/GOT-OCR2_0_CPU'; \ |
|
config = GOTConfig.from_pretrained(model_path); \ |
|
model = GOTModel.from_pretrained(model_path, config=config); \ |
|
tokenizer = AutoTokenizer.from_pretrained(model_path)" |
|
|
|
|
|
COPY . . |
|
|
|
EXPOSE 7860 |
|
|
|
CMD ["python", "app.py"] |