File size: 1,099 Bytes
284373e
a759345
284373e
 
 
 
 
 
 
 
 
a759345
284373e
 
 
 
a759345
284373e
 
 
a759345
284373e
 
a759345
284373e
 
 
a759345
284373e
 
a759345
 
8edbea9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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"]