Spaces:
Sleeping
Sleeping
| FROM python:3.10-slim | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PIP_NO_CACHE_DIR=1 | |
| ENV PORT=7860 | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| ffmpeg \ | |
| git \ | |
| libsndfile1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| COPY requirements-train.txt /app/requirements-train.txt | |
| COPY train_openwakeword.py /app/train_openwakeword.py | |
| COPY download_file.py /app/download_file.py | |
| COPY download_openwakeword_assets.py /app/download_openwakeword_assets.py | |
| COPY huggingface_space/requirements.txt /app/huggingface_space/requirements.txt | |
| COPY huggingface_space/__init__.py /app/huggingface_space/__init__.py | |
| COPY huggingface_space/app.py /app/huggingface_space/app.py | |
| RUN python -m pip install --upgrade pip "setuptools<81" wheel \ | |
| && python -m pip install \ | |
| --index-url https://download.pytorch.org/whl/cpu \ | |
| "torch==2.2.2+cpu" \ | |
| "torchaudio==2.2.2+cpu" \ | |
| && python -m pip install -r /app/requirements-train.txt \ | |
| && python -m pip install -r /app/huggingface_space/requirements.txt \ | |
| && python -c "import openwakeword, torch, torchmetrics, onnx, onnxruntime, piper, piper_phonemize, fastapi; print('dependency smoke test ok')" | |
| RUN mkdir -p /app/assets \ | |
| && git clone https://github.com/rhasspy/piper-sample-generator /app/assets/piper-sample-generator \ | |
| && mkdir -p /app/assets/piper-sample-generator/models \ | |
| && python /app/download_file.py \ | |
| "https://github.com/rhasspy/piper-sample-generator/releases/download/v2.0.0/en_US-libritts_r-medium.pt" \ | |
| "/app/assets/piper-sample-generator/models/en_US-libritts_r-medium.pt" \ | |
| && python /app/download_openwakeword_assets.py \ | |
| --assets-dir /app/assets \ | |
| --rir \ | |
| --poc-features \ | |
| --fma-hours 0.05 | |
| ENV OPENWAKEWORD_PIPER_SAMPLE_GENERATOR_PATH=/app/assets/piper-sample-generator | |
| ENV OPENWAKEWORD_RIR_PATHS=/app/assets/mit_rirs | |
| ENV OPENWAKEWORD_BACKGROUND_PATHS=/app/assets/background_clips | |
| ENV OPENWAKEWORD_FALSE_POSITIVE_VALIDATION_DATA_PATH=/app/assets/validation_set_features.npy | |
| ENV OPENWAKEWORD_FEATURE_DATA_FILE=/app/assets/validation_set_features.npy | |
| RUN python -c "from huggingface_space.app import app; print('fastapi app import ok')" | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "huggingface_space.app:app", "--host", "0.0.0.0", "--port", "7860"] | |