SEO / Dockerfile
pkm13's picture
Upload 10 files
e5ab217 verified
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Download Hugging Face models during build (cached in image)
RUN python -c "from transformers import pipeline; pipeline('token-classification', model='ml6team/keyphrase-extraction-distilbert-inspec')"
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
RUN python -c "from transformers import BartForConditionalGeneration, BartTokenizer; BartForConditionalGeneration.from_pretrained('facebook/bart-large-cnn'); BartTokenizer.from_pretrained('facebook/bart-large-cnn')"
# Copy application code
COPY . .
# Expose port (default for HF Spaces)
EXPOSE 7860
# Run FastAPI server
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]