File size: 954 Bytes
8d220a7
 
 
 
 
 
 
 
 
 
181e438
 
 
8d220a7
9e70b23
181e438
8d220a7
 
 
 
 
 
 
 
 
 
 
 
 
741c913
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
FROM python:3.11-slim

WORKDIR /app

# Set environment variables to fix permissions
ENV HOME=/tmp
ENV STREAMLIT_CONFIG_DIR=/tmp/.streamlit
ENV TRANSFORMERS_CACHE=/tmp/.cache
ENV HF_HOME=/tmp/.cache/huggingface

# Copy requirements and install dependencies.
# Install CPU-only torch first (Spaces are CPU); avoids pulling multi-GB CUDA
# wheels that overflow the build disk.
COPY requirements.txt .
RUN pip install --no-cache-dir torch==2.4.1 --index-url https://download.pytorch.org/whl/cpu && \
    pip install --no-cache-dir -r requirements.txt

# Copy application files
COPY . .

# Create necessary directories with proper permissions
RUN mkdir -p /tmp/.streamlit && \
    mkdir -p /tmp/.cache && \
    chmod -R 777 /tmp

# Expose port 7860 (Hugging Face Spaces default)
EXPOSE 7860

# Run the Streamlit app
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.headless=true", "--server.fileWatcherType=none"]