Spaces:
Sleeping
Sleeping
| # Use standard Python image - compatible with HF Spaces | |
| FROM python:3.10 | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| curl \ | |
| build-essential \ | |
| cmake \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Upgrade pip | |
| RUN pip install --upgrade pip | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements | |
| COPY requirements.txt . | |
| # Install PyTorch 2.5.0 with compatible TorchVision 0.20.0 - using safetensors to avoid CVE-2025-32434 | |
| RUN pip install torch==2.5.0 torchvision==0.20.0 torchaudio==2.5.0 --index-url https://download.pytorch.org/whl/cu121 | |
| # Skip llama-cpp-python to avoid compilation - using transformers instead | |
| # Install other requirements | |
| RUN pip install -r requirements.txt | |
| # Copy application files | |
| COPY app.py . | |
| COPY gradio_app.py . | |
| COPY README.md . | |
| # Create cache directories with proper permissions | |
| RUN mkdir -p /app/.cache/matplotlib /app/.cache/fontconfig && chmod -R 777 /app/.cache | |
| ENV HF_HOME=/app/.cache | |
| ENV HF_DATASETS_CACHE=/app/.cache | |
| ENV OMP_NUM_THREADS=4 | |
| ENV MPLCONFIGDIR=/app/.cache/matplotlib | |
| ENV FONTCONFIG_FILE=/app/.cache/fontconfig | |
| # Expose port | |
| EXPOSE 7860 | |
| # Run the Gradio application | |
| CMD ["python", "gradio_app.py"] |