File size: 953 Bytes
7111e1a
 
 
 
 
 
 
 
8eb04cb
7111e1a
486ed05
7111e1a
 
 
 
 
 
486ed05
 
 
 
 
 
 
7111e1a
 
 
 
 
 
 
98abd97
7111e1a
486ed05
 
 
7111e1a
 
 
 
 
 
 
486ed05
 
 
 
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
FROM python:3.10-slim

# Install system dependencies
RUN apt-get update && apt-get install -y \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender-dev \
    libgl1 \
    libgomp1 \
    poppler-utils \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy requirements and install Python dependencies
COPY requirements.txt .

# Install CPU-only torch first to avoid downloading the huge CUDA build (~2GB)
RUN pip install --no-cache-dir \
    torch \
    torchvision \
    --index-url https://download.pytorch.org/whl/cpu

RUN pip install --no-cache-dir \
    flask \
    flask-cors \
    numpy \
    opencv-python-headless \
    Pillow \
    transformers \
    sentencepiece \
    pymysql \
    python-dotenv \
    spacy \
    scikit-learn

# Copy app files
COPY . .

# HuggingFace Spaces requires port 7860
EXPOSE 7860

# Flush stdout immediately so logs appear in HuggingFace Spaces
ENV PYTHONUNBUFFERED=1

CMD ["python", "-u", "app.py"]