File size: 1,283 Bytes
bf883f3
 
0bf99b7
 
 
bf883f3
0bf99b7
 
 
 
 
4656a02
 
0bf99b7
 
 
bf883f3
0bf99b7
 
 
 
bf883f3
0bf99b7
 
67f9bcb
 
0bf99b7
4656a02
0bf99b7
 
 
 
bf883f3
0bf99b7
be67b49
0bf99b7
 
992eedb
 
bd1b0d6
 
444b4d9
992eedb
 
0bf99b7
 
 
 
be67b49
 
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
# Use standard Python image - compatible with HF Spaces
FROM python:3.10

# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive

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

# Upgrade pip
RUN pip install --upgrade pip

# Set working directory
WORKDIR /app

# Copy requirements
COPY requirements.txt .

# Install PyTorch 2.5.0 with compatible TorchVision 0.20.0 - using safetensors to avoid CVE-2025-32434
RUN pip install torch==2.5.0 torchvision==0.20.0 torchaudio==2.5.0 --index-url https://download.pytorch.org/whl/cu121

# Skip llama-cpp-python to avoid compilation - using transformers instead

# Install other requirements
RUN pip install -r requirements.txt

# Copy application files
COPY app.py .
COPY gradio_app.py .
COPY README.md .

# Create cache directories with proper permissions
RUN mkdir -p /app/.cache/matplotlib /app/.cache/fontconfig && chmod -R 777 /app/.cache
ENV HF_HOME=/app/.cache
ENV HF_DATASETS_CACHE=/app/.cache
ENV OMP_NUM_THREADS=4
ENV MPLCONFIGDIR=/app/.cache/matplotlib
ENV FONTCONFIG_FILE=/app/.cache/fontconfig

# Expose port
EXPOSE 7860

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