File size: 1,458 Bytes
66ef536
550f68a
66ef536
73fe9ec
66ef536
 
 
 
 
c97deb7
66ef536
c97deb7
 
 
66ef536
 
 
 
 
 
 
c97deb7
 
 
 
 
 
 
 
 
 
66ef536
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# ===============================
# Base image
# ===============================
FROM python:3.10-slim

# Set working directory
WORKDIR /app

# ===============================
# Install system dependencies
# ===============================
RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    && rm -rf /var/lib/apt/lists/*

# ===============================
# Copy dependency list and install packages
# ===============================
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt


# ===============================
# Pre-download and cache model weights
# ===============================
RUN python -c "from transformers import AutoTokenizer, AutoModelForSequenceClassification; \
model='fakespot-ai/roberta-base-ai-text-detection-v1'; \
AutoTokenizer.from_pretrained(model, cache_dir='/app/model'); \
AutoModelForSequenceClassification.from_pretrained(model, cache_dir='/app/model')"


# ===============================
# Copy application files
# ===============================
COPY . .

# ===============================
# Environment configuration
# ===============================
ENV TRANSFORMERS_CACHE=/app/model \
    HF_HOME=/app/model \
    PYTHONUNBUFFERED=1

# ===============================
# Expose Gradio default port
# ===============================
EXPOSE 7860

# ===============================
# Start the Gradio app
# ===============================
CMD ["python", "app.py"]