Spaces:
Sleeping
Sleeping
| FROM node:20-slim AS frontend | |
| WORKDIR /build | |
| COPY app/package.json app/package-lock.json* ./ | |
| RUN npm ci | |
| COPY app/ . | |
| RUN npm run build | |
| # --- Python backend --- | |
| FROM python:3.12-slim | |
| # System deps: ffmpeg for audio processing, yt-dlp needs it too | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ffmpeg \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Install Python dependencies | |
| # basic-pitch pulls in tensorflow on Linux, but we only use ONNX runtime. | |
| # Install it with --no-deps and manually specify what we need. | |
| COPY api/requirements.txt /app/api/requirements.txt | |
| RUN pip install --no-cache-dir \ | |
| fastapi uvicorn[standard] python-multipart \ | |
| onnxruntime pretty_midi librosa scipy numpy "setuptools<81" \ | |
| yt-dlp mir-eval resampy scikit-learn && \ | |
| pip install --no-cache-dir --no-deps basic-pitch | |
| # Install Demucs for full-song source separation (CPU-only PyTorch) | |
| # Must install torch+torchaudio from CPU index FIRST, then demucs, | |
| # otherwise demucs pulls CUDA torchaudio from PyPI (2GB+). | |
| RUN pip install --no-cache-dir \ | |
| torch torchaudio --index-url https://download.pytorch.org/whl/cpu && \ | |
| pip install --no-cache-dir torchcodec demucs | |
| # Copy application code | |
| COPY transcriber/ /app/transcriber/ | |
| COPY api/ /app/api/ | |
| # Copy built frontend | |
| COPY --from=frontend /build/dist /app/app/dist | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "api.server:app", "--host", "0.0.0.0", "--port", "7860"] | |