Update Dockerfile
Browse files- Dockerfile +14 -5
Dockerfile
CHANGED
|
@@ -7,12 +7,11 @@ FROM python:3.9-slim
|
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
# ===============================
|
| 10 |
-
#
|
| 11 |
# ===============================
|
| 12 |
-
RUN
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
AutoModelForSequenceClassification.from_pretrained(model, cache_dir='/app/model')"
|
| 16 |
|
| 17 |
# ===============================
|
| 18 |
# Copy dependency list and install packages
|
|
@@ -20,6 +19,16 @@ AutoModelForSequenceClassification.from_pretrained(model, cache_dir='/app/model'
|
|
| 20 |
COPY requirements.txt .
|
| 21 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
# ===============================
|
| 24 |
# Copy application files
|
| 25 |
# ===============================
|
|
|
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
# ===============================
|
| 10 |
+
# Install system dependencies
|
| 11 |
# ===============================
|
| 12 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 13 |
+
git \
|
| 14 |
+
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
| 15 |
|
| 16 |
# ===============================
|
| 17 |
# Copy dependency list and install packages
|
|
|
|
| 19 |
COPY requirements.txt .
|
| 20 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 21 |
|
| 22 |
+
|
| 23 |
+
# ===============================
|
| 24 |
+
# Pre-download and cache model weights
|
| 25 |
+
# ===============================
|
| 26 |
+
RUN python -c "from transformers import AutoTokenizer, AutoModelForSequenceClassification; \
|
| 27 |
+
model='fakespot-ai/roberta-base-ai-text-detection-v1'; \
|
| 28 |
+
AutoTokenizer.from_pretrained(model, cache_dir='/app/model'); \
|
| 29 |
+
AutoModelForSequenceClassification.from_pretrained(model, cache_dir='/app/model')"
|
| 30 |
+
|
| 31 |
+
|
| 32 |
# ===============================
|
| 33 |
# Copy application files
|
| 34 |
# ===============================
|