Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| # libsndfile1 is needed by the `soundfile` package for writing WAV files. | |
| # sox (+ format plugins) is needed because qwen_tts' audio pipeline shells | |
| # out to the `sox` CLI binary directly -- the Python `soundfile`/`torchaudio` | |
| # packages alone don't provide it. | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libsndfile1 \ | |
| sox \ | |
| libsox-fmt-all \ | |
| && apt-get clean && rm -rf /var/lib/apt/lists/* | |
| # Spaces run containers as UID 1000; matching that avoids permission issues | |
| # writing to the HF cache dir under $HOME. | |
| RUN useradd -m -u 1000 user | |
| WORKDIR /home/user/app | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| COPY --chown=user . . | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| PYTHONUNBUFFERED=1 | |
| # PYTHONUNBUFFERED=1 makes the startup/timing print() logs show up in the | |
| # Space's log viewer immediately instead of sitting in a buffer. | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |