Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +8 -9
Dockerfile
CHANGED
|
@@ -2,33 +2,32 @@ FROM python:3.10-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# Install system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
-
git bash wget build-essential libsndfile1 \
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
# Clone and install the custom NeMo fork required by IndicConformerASR
|
| 14 |
RUN git clone https://github.com/AI4Bharat/NeMo.git \
|
| 15 |
&& cd NeMo \
|
| 16 |
&& git checkout nemo-v2 \
|
| 17 |
&& bash reinstall.sh \
|
|
|
|
|
|
|
| 18 |
&& cd ..
|
| 19 |
|
| 20 |
# Install FastAPI, Piper TTS, and patch the known dependency issues
|
| 21 |
RUN pip install --no-cache-dir "numpy<2.0" huggingface_hub==0.23.2 fastapi uvicorn python-multipart "piper-tts==1.2.0"
|
| 22 |
|
| 23 |
-
# Fetch the Piper Nepali Chitwan model directly
|
| 24 |
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"
|
| 25 |
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"
|
| 26 |
|
| 27 |
# Copy the FastAPI app into the container
|
| 28 |
COPY app.py /app/app.py
|
| 29 |
|
| 30 |
-
# Hugging Face Spaces route traffic through port 7860
|
| 31 |
EXPOSE 7860
|
| 32 |
|
| 33 |
# Start the asynchronous Uvicorn server
|
| 34 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install system dependencies (added ffmpeg just in case torchaudio needs it for your audio types)
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
+
git bash wget build-essential libsndfile1 ffmpeg \
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
+
# Combine the NeMo install and the PyTorch CPU override into ONE step.
|
| 11 |
+
# This ensures matching versions (2.1.2) and prevents Docker from caching massive GPU binaries.
|
|
|
|
|
|
|
| 12 |
RUN git clone https://github.com/AI4Bharat/NeMo.git \
|
| 13 |
&& cd NeMo \
|
| 14 |
&& git checkout nemo-v2 \
|
| 15 |
&& bash reinstall.sh \
|
| 16 |
+
&& pip uninstall -y torch torchvision torchaudio \
|
| 17 |
+
&& 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 \
|
| 18 |
&& cd ..
|
| 19 |
|
| 20 |
# Install FastAPI, Piper TTS, and patch the known dependency issues
|
| 21 |
RUN pip install --no-cache-dir "numpy<2.0" huggingface_hub==0.23.2 fastapi uvicorn python-multipart "piper-tts==1.2.0"
|
| 22 |
|
| 23 |
+
# Fetch the Piper Nepali Chitwan model directly
|
| 24 |
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"
|
| 25 |
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"
|
| 26 |
|
| 27 |
# Copy the FastAPI app into the container
|
| 28 |
COPY app.py /app/app.py
|
| 29 |
|
|
|
|
| 30 |
EXPOSE 7860
|
| 31 |
|
| 32 |
# Start the asynchronous Uvicorn server
|
| 33 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|