Spaces:
Build error
Build error
| # 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 \ | |
| libopenblas-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 (excluding large files) | |
| 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 | |
| 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/ | |
| # 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 | |
| # 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"] |