File size: 1,076 Bytes
c30f358
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43d677a
c30f358
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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"]