Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| PORT=8000 | |
| WORKDIR /app | |
| # System packages | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ca-certificates \ | |
| curl \ | |
| tar \ | |
| ffmpeg \ | |
| git \ | |
| build-essential \ | |
| gcc \ | |
| g++ \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Python dependencies | |
| # Includes Groq's transcription client from requirements.txt | |
| COPY requirements.txt ./ | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # App files | |
| COPY . . | |
| # Install Piper | |
| RUN mkdir -p /app/piper \ | |
| && curl -L "https://github.com/rhasspy/piper/releases/latest/download/piper_linux_x86_64.tar.gz" \ | |
| -o /tmp/piper.tar.gz \ | |
| && tar -xzf /tmp/piper.tar.gz -C /app/piper --strip-components=1 \ | |
| && chmod +x /app/piper/piper \ | |
| && rm -f /tmp/piper.tar.gz | |
| # Download Urdu voice model | |
| RUN curl -L \ | |
| "https://huggingface.co/IhorShevchuk/piper-voice-ur-fasih/resolve/main/ur_PK-fasih-medium-model.onnx" \ | |
| -o /app/ur_PK-fasih-medium-model.onnx | |
| RUN curl -L \ | |
| "https://huggingface.co/IhorShevchuk/piper-voice-ur-fasih/resolve/main/ur_PK-fasih-medium-model.onnx.json" \ | |
| -o /app/ur_PK-fasih-medium-model.onnx.json | |
| EXPOSE 8000 | |
| HEALTHCHECK CMD curl --fail http://localhost:8000/health || exit 1 | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] |