| FROM python:3.11-slim | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y ffmpeg git libsndfile1 && rm -rf /var/lib/apt/lists/* | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir torch==2.2.0 torchaudio==2.2.0 --index-url https://download.pytorch.org/whl/cpu | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| RUN python -c "import pathlib, site; [p.write_text(p.read_text().replace('from torchaudio.backend.common import AudioMetaData', 'try:\n from torchaudio.backend.common import AudioMetaData\nexcept ImportError:\n from torchaudio._backend.common import AudioMetaData')) for d in site.getsitepackages() if (p := pathlib.Path(d) / 'df/io.py').exists()]" | |
| COPY backend/ ./backend/ | |
| COPY frontend/ ./frontend/ | |
| RUN mkdir -p backend/uploads separated | |
| RUN python -c "from demucs.pretrained import get_model; get_model('mdx_extra')" | |
| RUN python -c "from df.enhance import init_df; init_df()" | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"] | |