Spaces:
Runtime error
Runtime error
File size: 2,923 Bytes
93f200c d67e06a 7651129 d67e06a 93f200c d67e06a 1eeb779 93f200c 88d3718 fc52d6c b1e8e84 93f200c b1e8e84 0b9e281 b1e8e84 fc52d6c d67e06a fc52d6c d67e06a cab81cf d67e06a cab81cf d67e06a cab81cf 0b9e281 cab81cf 88d3718 0b9e281 15c71fc d67e06a cab81cf d67e06a cab81cf d67e06a |
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# Use an official Python runtime as a parent image
FROM python:3.9-slim-buster
# Set the working directory in the container
WORKDIR /app
# Install build tools and other dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
pkg-config \
libblis-dev \
python3-venv \
python3-dev \
wget \
git \
gcc \
g++ \
libffi-dev \
zlib1g-dev
# Create a virtual environment
RUN python3 -m venv venv
# Activate the virtual environment
RUN . /app/venv/bin/activate
# Copy the locally cloned Coqui TTS repository
COPY TTS /app/TTS
# Set the working directory to the TTS directory
WORKDIR /app/TTS
# Set a generic architecture flag
ENV BLIS_ARCH="generic"
# Try to agree to the Coqui TTS license via environment variable
ENV COQUI_TTS_AGREED=1
# Install Coqui TTS requirements
RUN . /app/venv/bin/activate && pip install -r requirements.txt --timeout=300
# Explicitly install the TTS package itself in editable mode
RUN . /app/venv/bin/activate && pip install -e . --timeout=300
# Change working directory back to /app
WORKDIR /app
# Create the model directory (relative to /app)
RUN mkdir -p /app/models/xtts_v2
# Download XTTS v2 model files
RUN wget -O /app/models/xtts_v2/config.json https://huggingface.co/coqui/XTTS-v2/resolve/main/config.json?download=true
RUN wget -O /app/models/xtts_v2/model.pth https://huggingface.co/coqui/XTTS-v2/resolve/main/model.pth?download=true
RUN wget -O /app/models/xtts_v2/vocab.json https://huggingface.co/coqui/XTTS-v2/resolve/main/vocab.json?download=true
RUN wget -O /app/models/xtts_v2/dvae.pth https://huggingface.co/coqui/XTTS-v2/resolve/main/dvae.pth?download=true
RUN wget -O /app/models/xtts_v2/speakers_xtts.pth https://huggingface.co/coqui/XTTS-v2/resolve/main/speakers_xtts.pth?download=true
# Create the audio directory if it doesn't exist
RUN mkdir -p /app/audio
# Copy the speaker reference file from the root directory
COPY speaker_reference.wav /app/audio/speaker_reference.wav
# Copy the web page files
COPY web /app/web
# Copy the application code
COPY local_server_new.py /app/
# Install your other dependencies (fastapi, uvicorn, bangla, etc.)
COPY requirements.txt /app/
RUN . /app/venv/bin/activate && pip install -r /app/requirements.txt --no-cache-dir --timeout=300
# Disable numba caching
ENV NUMBA_DISABLE_CACHE=1
# Clear numba and llvmlite cache (Let's keep this for now, though it might not be needed)
RUN rm -rf /app/venv/lib/python3.9/site-packages/numba/__pycache__ /app/venv/lib/python3.9/site-packages/llvmlite/__pycache__
# Create start.sh script
RUN echo "#!/bin/bash" > start.sh && \
echo "source /app/venv/bin/activate" >> start.sh && \
echo "/app/venv/bin/python -m uvicorn local_server_new:app --host 0.0.0.0 --port 80" >> start.sh && \
chmod +x start.sh
# Expose port
EXPOSE 80
# Run the app using the script
CMD ["./start.sh"] |