File size: 1,501 Bytes
09c1319
 
 
 
75d6bee
09c1319
0b0dcfb
09c1319
 
0b0dcfb
09c1319
 
 
 
0b0dcfb
 
09c1319
 
75d6bee
 
09c1319
0b0dcfb
09c1319
 
 
 
 
 
0858832
 
 
09c1319
 
 
0b0dcfb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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"]