File size: 2,003 Bytes
f6a7c3c
 
 
e149c7d
 
466110d
5f0557f
 
 
 
33f5214
5f0557f
319fa3e
5f0557f
8cef504
5f0557f
234c57a
95e075b
7d2376d
 
 
 
95e075b
5f7b98a
5282ca7
c8228b3
f39b8e7
 
33f5214
0720389
33f5214
 
6edfc0c
33f5214
 
 
 
 
 
 
 
 
c7fa5c6
 
 
 
 
33f5214
 
 
 
 
 
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
# 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_laura-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