Spaces:
Sleeping
Sleeping
File size: 1,280 Bytes
e62f11c 8e66145 6ca0914 8e66145 e151d55 8242927 e151d55 8242927 8e66145 8242927 8e66145 e151d55 8e66145 ed78072 9edf83b 542933f ed78072 8e66145 8242927 542933f c13c6ef 542933f 8e66145 6ca0914 542933f |
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
FROM python:3.9
WORKDIR /app
# Install git, git-lfs, and build dependencies for native extensions
RUN apt-get update && \
apt-get install -y git git-lfs build-essential cmake pkg-config libpq-dev gcc g++ && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Copy requirements file
COPY requirements.txt .
# Install dependencies with pip upgrade
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir --upgrade -r requirements.txt
# Pre-download NLTK data during build time
RUN python -c "import nltk; nltk.download('punkt'); nltk.download('wordnet'); nltk.download('stopwords')" && \
mkdir -p /app/nltk_data && \
cp -r /root/nltk_data/* /app/nltk_data/ && \
chmod -R 755 /app/nltk_data
# Create necessary directories
RUN mkdir -p data/users data/sessions data/conversations data/feedback && \
mkdir -p mental_health_model_artifacts/chroma_db
# Copy application files
COPY app.py .
COPY .env.example .env
COPY api_mental_health.py .
COPY run_api.sh .
# Copy model artifacts directory
COPY mental_health_model_artifacts/ mental_health_model_artifacts/
# Make the script executable
RUN chmod +x run_api.sh
# Expose the port Hugging Face Spaces expects
EXPOSE 7860
# Command to run the application
CMD ["./run_api.sh"]
|