Spaces:
Runtime error
Runtime error
| FROM python:3.9-slim-buster | |
| # Install Git (if not already included - might be needed for other parts of your repo) | |
| RUN apt-get update && apt-get install -y git | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy your entire repository content (excluding the potentially problematic TTS submodule) | |
| COPY . /app/ | |
| # Install build tools and libblis-dev BEFORE anything else | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| cmake \ | |
| pkg-config \ | |
| libblis-dev \ | |
| python3-venv \ | |
| python3-dev \ | |
| wget \ | |
| libopenblas-dev | |
| # Create a directory for numba cache | |
| RUN mkdir -p /tmp/.numba_cache | |
| # Create a virtual environment | |
| RUN python3 -m venv venv | |
| # Activate the virtual environment and then install requirements with BLIS env vars | |
| RUN . /app/venv/bin/activate && \ | |
| export BLIS_ARCH="generic" && \ | |
| export CC="cc" && \ | |
| pip install --no-cache-dir -r /app/requirements.txt --timeout=300 | |
| # Create the model directory | |
| 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.wav file if it exists at the root | |
| 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/ | |
| # 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"] |