File size: 1,089 Bytes
af779bc
 
 
 
 
 
777aae5
 
 
 
 
 
4d3ba4b
af779bc
 
4d3ba4b
af779bc
 
6acd536
af779bc
6acd536
af779bc
 
 
6acd536
af779bc
 
 
 
4d3ba4b
af779bc
 
 
 
 
4d3ba4b
af779bc
 
4d3ba4b
af779bc
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
# Use the official Python 3.9 image
FROM python:3.9

# Set the working directory
WORKDIR /app

# Create a directory for Hugging Face cache
RUN mkdir -p /app/.cache/huggingface/hub

# Set the environment variable to point to the writable cache directory
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/hub

# Copy your FastAPI code and setup scripts
COPY . .

# Install pip and upgrade it
RUN pip install --upgrade pip

# Install core dependencies including FastAPI and Uvicorn
RUN pip install \
    fastapi uvicorn \
    nltk sacremoses pandas regex mock \
    "transformers>=4.33.2" mosestokenizer \
    bitsandbytes scipy accelerate datasets \
    sentencepiece

# Download NLTK punkt tokenizer
RUN python3 -c "import nltk; nltk.download('punkt')"

# Clone and install IndicTrans2 toolkit
RUN git clone https://github.com/VarunGumma/IndicTransToolkit && \
    cd IndicTransToolkit && \
    pip install --editable ./ && \
    cd ..

# Expose port 7860 for FastAPI (or change if needed)
EXPOSE 7860

# Start the FastAPI app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]