Spaces:
Running
Running
| FROM python:3.11-slim | |
| # ffmpeg for audio decode (muscriptor wraps torchaudio/soundfile), | |
| # libsndfile1 for soundfile/librosa, git for `pip install git+…`. | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ffmpeg \ | |
| libsndfile1 \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| PORT=7860 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| PIP_DISABLE_PIP_VERSION_CHECK=1 \ | |
| HF_HOME=/data/hf \ | |
| TRANSFORMERS_CACHE=/data/hf \ | |
| HUGGINGFACE_HUB_CACHE=/data/hf | |
| WORKDIR /app | |
| # Install deps first for better layer caching. | |
| COPY requirements.txt /app/requirements.txt | |
| RUN pip install -r /app/requirements.txt | |
| # App | |
| COPY app.py /app/app.py | |
| # Persistent storage for muscriptor model weights + gradio cache | |
| RUN mkdir -p /data/hf | |
| VOLUME ["/data"] | |
| EXPOSE 7860 | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \ | |
| CMD python -c "import urllib.request,sys; \ | |
| sys.exit(0) if urllib.request.urlopen('http://127.0.0.1:7860/', timeout=5).status == 200 else sys.exit(1)" | |
| CMD ["python", "app.py"] |