Spaces:
Build error
Build error
| # Khmer ASR + TTS API — Hugging Face Spaces (Docker Space, CPU) | |
| FROM python:3.10-slim | |
| # System libs: libsndfile for soundfile, ffmpeg for librosa decoding, | |
| # espeak-ng in case the TTS text frontend needs it, git for hub downloads. | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libsndfile1 \ | |
| ffmpeg \ | |
| espeak-ng \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # HF Spaces runs containers as user 1000 | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| HF_HOME=/home/user/.cache/huggingface \ | |
| OUTPUT_DIR=/home/user/outputs | |
| WORKDIR /home/user/app | |
| # CPU-only torch first (much smaller image than the default CUDA wheels) | |
| RUN pip install --no-cache-dir --user \ | |
| torch==2.2.2 torchaudio==2.2.2 \ | |
| --index-url https://download.pytorch.org/whl/cpu | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --user -r requirements.txt | |
| COPY --chown=user main.py . | |
| RUN mkdir -p /home/user/outputs /home/user/.cache/huggingface | |
| # HF Spaces expects the app on port 7860 | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |