Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Download Dockerfile from MsThai/switchlingo: direct link, hf CLI and curl.
- Browser
- Download file 1.6 kB
-
https://huggingface.co/spaces/MsThai/switchlingo/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/MsThai/switchlingo/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/MsThai/switchlingo/resolve/main/Dockerfile
1.6 kB
| # SwitchLingo - container for Hugging Face Spaces (or any Docker host) | |
| FROM python:3.12-slim | |
| RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg fonts-dejavu-core fonts-noto-core fonts-noto-cjk && rm -rf /var/lib/apt/lists/* | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH HF_HOME=/home/user/.cache/huggingface \ | |
| OXT_DATA=/home/user/data PYTHONUNBUFFERED=1 | |
| WORKDIR /home/user/app | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --user torch --index-url https://download.pytorch.org/whl/cpu && \ | |
| pip install --no-cache-dir --user -r requirements.txt | |
| # Pre-download the speech + translation models so the first visitor doesn't wait | |
| RUN python -c "from faster_whisper import WhisperModel; WhisperModel('small', device='cpu', compute_type='int8')" && \ | |
| python -c "from huggingface_hub import snapshot_download; snapshot_download('JustFrederik/nllb-200-distilled-600M-ct2-int8'); snapshot_download('Nextcloud-AI/madlad400-3b-mt-ct2-int8')" && \ | |
| python -c "import transformers; transformers.AutoTokenizer.from_pretrained('google/madlad400-3b-mt')" && \ | |
| python -c "import transformers; transformers.AutoTokenizer.from_pretrained('facebook/nllb-200-distilled-600M')" && \ | |
| python -c "from huggingface_hub import hf_hub_download as d; [d('myshell-ai/OpenVoiceV2', f) for f in ('converter/config.json', 'converter/checkpoint.pth')]" | |
| COPY --chown=user . . | |
| EXPOSE 7860 | |
| CMD ["python", "-m", "uvicorn", "app.server:app", "--host", "0.0.0.0", "--port", "7860", "--proxy-headers", "--forwarded-allow-ips", "*"] | |