models-cpu-test / Dockerfile
Pushkar02-n's picture
Update Dockerfile
0858832 verified
Raw
History Blame Contribute Delete
1.5 kB
FROM python:3.10-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git bash wget build-essential libsndfile1 ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Combine the NeMo install and the PyTorch CPU override into ONE step.
RUN git clone https://github.com/AI4Bharat/NeMo.git \
&& cd NeMo \
&& git checkout nemo-v2 \
&& bash reinstall.sh \
&& pip uninstall -y torch torchvision torchaudio \
&& pip install --no-cache-dir torch==2.1.2+cpu torchvision==0.16.2+cpu torchaudio==2.1.2+cpu --index-url https://download.pytorch.org/whl/cpu \
&& cd ..
# Install FastAPI, Piper TTS, and patch the known dependency issues (Added pyarrow downgrade here)
RUN pip install --no-cache-dir "numpy<2.0" "pyarrow<15.0.0" huggingface_hub==0.23.2 fastapi uvicorn python-multipart "piper-tts==1.2.0"
# Fetch the Piper Nepali Chitwan model directly
RUN wget -q -O chitwan.onnx "https://huggingface.co/rhasspy/piper-voices/resolve/main/ne/ne_NP/chitwan/medium/ne_NP-chitwan-medium.onnx?download=true"
RUN wget -q -O chitwan.onnx.json "https://huggingface.co/rhasspy/piper-voices/resolve/main/ne/ne_NP/chitwan/medium/ne_NP-chitwan-medium.onnx.json?download=true"
# Copy the FastAPI app into the container
COPY app.py /app/app.py
# Add this line to copy your uploaded NeMo model into the container!
COPY model.nemo /app/model.nemo
EXPOSE 7860
# Start the asynchronous Uvicorn server
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]