Spaces:
Runtime error
Runtime error
# 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"] | |