File size: 1,557 Bytes
82ac432
 
ea79faf
 
 
82ac432
ea79faf
 
 
 
 
82ac432
 
ea79faf
 
 
 
 
 
82ac432
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ea79faf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
54
55
56
57
58
# ZeroGPU Dockerfile for HF Spaces Pro - FIXED VERSION
FROM python:3.9-slim

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

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

# Create user (required for HF Spaces)
RUN useradd -m -u 1000 user
WORKDIR /app

# Upgrade pip first
RUN pip install --upgrade pip

# Install packages INDIVIDUALLY to catch errors
RUN pip install --no-cache-dir gradio==4.44.0
RUN pip install --no-cache-dir spaces
RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
RUN pip install --no-cache-dir transformers==4.48.2
RUN pip install --no-cache-dir sentence-transformers
RUN pip install --no-cache-dir python-docx
RUN pip install --no-cache-dir pymupdf
RUN pip install --no-cache-dir unstructured
RUN pip install --no-cache-dir sqlite-utils
RUN pip install --no-cache-dir pandas
RUN pip install --no-cache-dir numpy
RUN pip install --no-cache-dir huggingface_hub
RUN pip install --no-cache-dir accelerate

# Install PyLate LAST (it's finicky)
RUN pip install --no-cache-dir pylate==1.2.0

# Copy requirements file (as backup)
COPY --chown=user requirements.txt .

# Copy application code
COPY --chown=user . .

# Switch to user
USER user

# Set environment variables for user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Expose port
EXPOSE 7860

# Command to run the application
CMD ["python3", "app.py"]