Spaces:
Sleeping
Sleeping
File size: 847 Bytes
9f27751 1195e16 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | FROM python:3.12-slim
WORKDIR /app
# Set environment variables for cache directories
ENV HF_HOME=/tmp/huggingface
ENV TRANSFORMERS_CACHE=/tmp/huggingface/transformers
ENV HF_DATASETS_CACHE=/tmp/huggingface/datasets
# Upgrade pip
RUN python -m pip install --upgrade pip
# Copy dependencies and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Download NLTK data to /tmp
RUN python -m nltk.downloader -d /tmp/nltk_data vader_lexicon punkt stopwords wordnet omw-1.4
# Copy application code
COPY . .
# Create cache directories with proper permissions
RUN mkdir -p /tmp/huggingface /tmp/model_cache /tmp/nltk_data && \
chmod -R 777 /tmp/huggingface /tmp/model_cache /tmp/nltk_data
# Expose port 7860
EXPOSE 7860
# Run FastAPI
CMD ["uvicorn", "fastapi_example:app", "--host", "0.0.0.0", "--port", "7860"] |