HirCoir's picture
Update Dockerfile
5282ca7 verified
raw
history blame
2 kB
# Este contenedor solo funciona con modelos entrenados de:
# https://github.com/HirCoir/Piper-tts/blob/main/Clonar%20voz%20V2%20-%20Piper-TTS.ipynb
# Ya que estos deben de ser guardados en un repo de HuggingFace
FROM hircoir/piper-exporter:latest
RUN useradd -m -u 1000 app
RUN ls
# Tu token de hf en formato base64
# Pueses convertirlo desde https://www.base64encode.org/
# Recuerda crear un token con permisos de escritura para poder crear el repo de tu modelo convertido
# No olvides eliminar tu token una vez convertido en tu cuenta de HF
ENV TOKEN=aGZfaXhscFBXd1lCT0NRa3lMWFlEeFZkUHlidllPTGt5UmtTVg==
ENV REPO_ID=HirCoir/piper-laura-neuronal
ENV MODELNAME=es_MX_sorah-high
# No editar nada de abajo
USER root
WORKDIR /root/piper/src/python
COPY download-model.py .
COPY upload-onnx.py .
COPY upload-onnx.py .
COPY server.py /home/app/
RUN python3 download-model.py
RUN python3 -m piper_train.export_onnx model.ckpt ${MODELNAME}.onnx
RUN rm -f model.ckpt
RUN python3 upload-onnx.py
RUN mv ${MODELNAME}.onnx /home/app/${MODELNAME}.onnx
RUN mv ${MODELNAME}.onnx.json /home/app/${MODELNAME}.onnx.json
# Instalar App Piper
RUN apt install -y wget curl
# Define the base download URL
ENV DOWNLOAD_URL_BASE=https://github.com/rhasspy/piper/releases/download/2023.11.14-2/
WORKDIR /home/app
# Download and extract Piper binaries
RUN dpkgArch="$(dpkg --print-architecture)" && \
case "${dpkgArch##*-}" in \
amd64) DOWNLOAD_URL=${DOWNLOAD_URL_BASE}piper_linux_x86_64.tar.gz ;; \
armhf) DOWNLOAD_URL=${DOWNLOAD_URL_BASE}piper_linux_armv7l.tar.gz ;; \
arm64) DOWNLOAD_URL=${DOWNLOAD_URL_BASE}piper_linux_aarch64.tar.gz ;; \
*) echo "Unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac && \
curl -SL ${DOWNLOAD_URL} | tar -xzC ./ && \
mv piper piper_temp && \
mv piper_temp/* . && \
rm -rf piper_temp piper_*.tar.gz
RUN pip install flask
COPY index.html templates/index.html
COPY app.py app.py
RUN mkdir temp_audio
USER app
CMD python3 app.py