# Use an official Python runtime as a parent image FROM python:3.11-slim # Set the working directory WORKDIR /app # Install system dependencies (optional but recommended for some NLP libraries) RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* # Copy requirements and install COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Fix the KeyError by ensuring a compatible version is used # (This is already in requirements.txt, but we ensure it's prioritized) RUN pip install "indic-transliteration<2.3.45" # Setup the Sanskrit database (Required for process-sanskrit to work) RUN update-ps-database # Verify the import works now RUN python -c "import process_sanskrit; print('Sanskrit library loaded successfully!')" # Copy the rest of the application COPY . . EXPOSE 7860 ENV FLASK_APP=app.py CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]