Spaces:
Sleeping
Sleeping
| FROM nvidia/cuda:11.6.2-base-ubuntu20.04 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| WORKDIR /code | |
| # Install Python and dependencies | |
| RUN apt-get update && \ | |
| apt-get install -y python3 python3-pip git && \ | |
| apt-get clean && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Create cache directories with proper permissions | |
| RUN mkdir -p /tmp/transformers_cache && \ | |
| mkdir -p /tmp/hf_home && \ | |
| mkdir -p /tmp/hf_datasets_cache && \ | |
| mkdir -p /tmp/diffusers_cache && \ | |
| chmod -R 777 /tmp | |
| # Set environment variables for HF | |
| ENV HF_HOME=/tmp/hf_home | |
| ENV TRANSFORMERS_CACHE=/tmp/transformers_cache | |
| ENV HF_DATASETS_CACHE=/tmp/hf_datasets_cache | |
| # Copy requirements and install | |
| COPY requirements.txt . | |
| RUN pip3 install --no-cache-dir -r requirements.txt | |
| # Copy app files | |
| COPY app.py . | |
| # Expose port | |
| EXPOSE 7860 | |
| # Run the application with proper host to expose externally | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |