File size: 1,672 Bytes
edd7e81
c9d4f37
013acb1
6c3dcb0
 
 
 
013acb1
 
 
6c3dcb0
b579729
 
3d6ef9c
c9d4f37
3d6ef9c
 
c9d4f37
 
672b837
 
 
c9d4f37
 
 
6c3dcb0
672b837
 
 
 
 
 
 
 
c9d4f37
6c3dcb0
c9d4f37
 
6c3dcb0
013acb1
6c3dcb0
 
672b837
c9d4f37
3d6ef9c
c9d4f37
672b837
c9d4f37
 
672b837
c9d4f37
 
672b837
3d6ef9c
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
FROM nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04

# Set environment variables for cache directories and fixes
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
ENV HF_HOME=/app/.cache/huggingface
ENV MPLCONFIGDIR=/app/.cache/matplotlib
ENV FONTCONFIG_PATH=/etc/fonts
ENV FONTCONFIG_FILE=/etc/fonts/fonts.conf
ENV FC_CACHEDIR=/app/.cache/fontconfig
ENV OMP_NUM_THREADS=1
ENV PYTHONUNBUFFERED=1
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/lib/x86_64-linux-gnu/"

# Install Python 3.10 and system dependencies
RUN apt-get update && apt-get install -y \
    python3.10 \
    python3-pip \
    ffmpeg \
    git \
    wget \
    fonts-noto-core \
    fonts-noto-ui-core \
    fontconfig \
    && rm -rf /var/lib/apt/lists/*

# Download Devanagari fonts manually from GitHub
RUN mkdir -p /usr/share/fonts/truetype/noto && \
    cd /usr/share/fonts/truetype/noto && \
    wget -q https://github.com/notofonts/noto-fonts/raw/main/hinted/ttf/NotoSansDevanagari/NotoSansDevanagari-Regular.ttf && \
    wget -q https://github.com/notofonts/noto-fonts/raw/main/hinted/ttf/NotoSansDevanagari/NotoSansDevanagari-Bold.ttf && \
    fc-cache -fv

# Verify fonts are installed
RUN fc-list | grep -i devanagari || echo "Devanagari fonts installed manually"

# Set working directory
WORKDIR /app

# Create cache directories with proper permissions
RUN mkdir -p /app/.cache/huggingface /app/.cache/matplotlib /app/.cache/fontconfig && \
    chmod -R 777 /app/.cache

# Copy requirements and install Python packages
COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt

# Copy application
COPY app.py .

# Expose Gradio port
EXPOSE 7860

# Run the app
CMD ["python3", "app.py"]