Spaces:
Running on Zero
Running on Zero
| # Hugging Face Space (Docker SDK), free CPU tier: 2 vCPU / 16GB RAM. | |
| FROM python:3.11-slim | |
| # ffmpeg decodes whatever audio the backend posts; transformers' ffmpeg_read | |
| # shells out to it rather than depending on a Python codec stack. | |
| RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Spaces run as uid 1000; HF caches must be writable or model download fails. | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| HF_HOME=/home/user/.cache/huggingface \ | |
| PYTHONUNBUFFERED=1 | |
| WORKDIR $HOME/app | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --user -r requirements.txt | |
| COPY --chown=user app.py . | |
| # Spaces route external traffic to 7860. | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |