Spaces:
Running
Running
| FROM python:3.10-slim | |
| WORKDIR /app | |
| # System deps for audio processing | |
| RUN apt-get update && apt-get install -y \ | |
| ffmpeg \ | |
| libsndfile1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create user (HF requires user ID 1000) | |
| RUN useradd -m -u 1000 user | |
| # Install torch CPU-only first (much smaller than CUDA version) | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir torch>=2.5.0 torchaudio>=2.5.0 \ | |
| --index-url https://download.pytorch.org/whl/cpu | |
| # Install other deps | |
| COPY requirements_docker.txt /tmp/requirements.txt | |
| RUN pip install --no-cache-dir -r /tmp/requirements.txt | |
| # Copy app | |
| COPY app.py . | |
| # Permissions | |
| RUN mkdir -p /data/output && \ | |
| chown -R user:user /data /app | |
| USER user | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONIOENCODING=UTF-8 \ | |
| HOME=/home/user | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] | |