File size: 1,153 Bytes
0b8536a
 
 
 
 
 
 
a0f6119
 
 
0b8536a
a0f6119
 
ea506a5
a0f6119
 
 
 
0b8536a
a0f6119
 
0b8536a
a0f6119
 
 
 
ea506a5
a0f6119
 
 
0b8536a
a0f6119
 
 
 
 
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
FROM python:3.10-slim

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
        git-lfs \
            build-essential \
                && rm -rf /var/lib/apt/lists/*

                # Initialize git-lfs
                RUN git lfs install

                # Install Python packages
                COPY requirements.txt .
                RUN pip install --no-cache-dir --upgrade pip && \
                    pip install --no-cache-dir -r requirements.txt

                    # Copy application files
                    COPY . .

                    # Set up Hugging Face cache directory
                    ENV HF_HOME=/app/cache
                    ENV TRANSFORMERS_CACHE=/app/cache
                    ENV HF_HUB_CACHE=/app/cache

                    # Set environment variables for better performance
                    ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512
                    ENV CUDA_VISIBLE_DEVICES=0,1,2,3

                    # Expose port for the application
                    EXPOSE 7860

                    # Run the application
                    CMD ["python", "app.py"]