cstr/CrispASR
0
1FROM ubuntu:24.042WORKDIR /space3 4RUN printf 'Acquire::Retries "5";\nAcquire::http::Timeout "30";\nAcquire::https::Timeout "30";\n' \5 > /etc/apt/apt.conf.d/80-retries && \6 apt-get update && \7 apt-get install -y --fix-missing bash curl ffmpeg python3 python3-pip \8 libomp5 libgomp1 && \9 rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*10 11# Pre-built binaries from GitHub Releases — avoids the 6+ minute C++12# compilation that exceeds the HF free-tier Docker build timeout.13# v3: tarball with SOVERSION symlinks now includes lib symlinks (libcrispasr.so → libcrispasr.so.0.7.1 etc.)14ARG BIN_URL=https://github.com/CrispStrobe/CrispASR/releases/download/hf-space-bin/crispasr-bin-linux-x64.tar.gz?v=415RUN mkdir -p /opt/crispasr/build/bin && \16 curl -sL "${BIN_URL}" -o /tmp/crispasr-bin.tar.gz && \17 tar xzf /tmp/crispasr-bin.tar.gz -C /opt/crispasr/build/bin/ && \18 rm /tmp/crispasr-bin.tar.gz && \19 find /opt/crispasr/build/bin -name 'lib*.so*' -exec cp -a {} /usr/local/lib/ \; && \20 ldconfig21 22# Pre-download G2P dicts + kokoro model so TTS works on first call.23RUN mkdir -p /cache/.cache/crispasr && \24 curl -sL "https://huggingface.co/datasets/cstr/g2p-dicts/resolve/main/espeak_en.tsv" \25 -o /cache/.cache/crispasr/espeak_en.tsv && \26 curl -sL "https://raw.githubusercontent.com/cmusphinx/cmudict/refs/heads/master/cmudict.dict" \27 -o /cache/.cache/crispasr/cmudict.dict && \28 curl -sL "https://huggingface.co/cstr/kokoro-82m-GGUF/resolve/main/kokoro-82m-q8_0.gguf" \29 -o /cache/kokoro-82m-q8_0.gguf && \30 curl -sL "https://huggingface.co/cstr/kokoro-voices-GGUF/resolve/main/kokoro-voice-af_heart.gguf" \31 -o /cache/kokoro-voice-af_heart.gguf && \32 ls -lh /cache/ /cache/.cache/crispasr/ || true33 34# Fetch bundled sample audio from the GitHub repo (optional).35ARG CRISPASR_REPO=https://github.com/CrispStrobe/CrispASR36RUN mkdir -p /space/samples && \37 curl -sL "${CRISPASR_REPO}/raw/main/samples/jfk.wav" -o /space/samples/jfk.wav 2>/dev/null || true38 39COPY requirements.txt /space/requirements.txt40RUN pip3 install --no-cache-dir --break-system-packages -r /space/requirements.txt41 42COPY app.py start.sh /space/43RUN chmod +x /space/start.sh && \44 id -u 1000 >/dev/null 2>&1 || useradd -m -u 1000 app && \45 mkdir -p /models /cache && \46 chown -R 1000:1000 /space /opt/crispasr /models /cache47 48ENV PATH=/opt/crispasr/build/bin:$PATH49ENV HOME=/cache50ENV CRISPASR_SERVER_URL=http://127.0.0.1:808051ENV CRISPASR_CACHE_DIR=/cache52ENV CRISPASR_SAMPLES_DIR=/space/samples53ENV GRADIO_SERVER_NAME=0.0.0.054ENV GRADIO_SERVER_PORT=786055 56USER 100057EXPOSE 786058EXPOSE 808059ENTRYPOINT ["/space/start.sh"]60 