# Use a lightweight Python image FROM python:3.12-slim # Set working directory WORKDIR /code # Install system dependencies (optional but useful) RUN apt-get update && apt-get install -y \ build-essential \ && rm -rf /var/lib/apt/lists/* # Copy all project files COPY . /code # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Download NLTK data RUN python -m nltk.downloader stopwords wordnet # Hugging Face requires exposing port 7860 (even if Streamlit uses others) EXPOSE 7860 # Streamlit by default runs on port 8501 — must override for HF Spaces ENV PORT=7860 # Disable Streamlit telemetry & browser auto-open ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false ENV STREAMLIT_SERVER_HEADLESS=true # Command to run the app CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]