Spaces:
Sleeping
Sleeping
| FROM python:3.9-slim | |
| WORKDIR /code | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set environment variables for cache directories | |
| ENV HF_HOME=/tmp/huggingface | |
| ENV TRANSFORMERS_CACHE=/tmp/huggingface/transformers | |
| ENV HF_DATASETS_CACHE=/tmp/huggingface/datasets | |
| # Create cache directory with proper permissions | |
| RUN mkdir -p /tmp/huggingface && chmod -R 777 /tmp/huggingface | |
| # Copy requirements and install Python dependencies | |
| COPY ./requirements.txt /code/requirements.txt | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r /code/requirements.txt | |
| # Copy application code | |
| COPY ./app.py /code/app.py | |
| # Expose port | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |