| # Use the official Python 3.10.9 image | |
| FROM python:3.10.9 | |
| # Copy the current directory contents into the container at . | |
| COPY . . | |
| # Set the working directory to / | |
| WORKDIR /app | |
| # Install requirements.txt | |
| RUN pip install --upgrade pip --no-cache-dir --upgrade -r requirements.txt | |
| ENV TRANSFORMERS_CACHE=/app/cache | |
| ENV HF_HOME=/app/cache | |
| RUN mkdir -p /app/cache && chmod 777 /app/cache | |
| # download nltk data | |
| RUN python3 -c "import nltk; nltk.download('punkt_tab')" | |
| RUN python3 -c "import nltk; nltk.download('wordnet')" | |
| RUN python3 -c "import nltk; nltk.download('stopwords')" | |
| EXPOSE 7860 | |
| # Start the FastAPI app on port 7860, the default port expected by Spaces | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |