|
|
|
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu20.04 |
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive |
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \ |
|
wget \ |
|
git \ |
|
espeak \ |
|
espeak-ng \ |
|
ffmpeg \ |
|
tk \ |
|
mecab \ |
|
libmecab-dev \ |
|
mecab-ipadic-utf8 \ |
|
build-essential \ |
|
calibre \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
RUN ebook-convert --version |
|
|
|
|
|
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \ |
|
bash ~/miniconda.sh -b -p /opt/conda && \ |
|
rm ~/miniconda.sh |
|
|
|
|
|
|
|
|
|
ENV PATH=/opt/conda/bin:$PATH |
|
|
|
|
|
RUN conda create -n ebookenv python=3.10 -y |
|
|
|
|
|
SHELL ["conda", "run", "-n", "ebookenv", "/bin/bash", "-c"] |
|
|
|
|
|
RUN conda install -n ebookenv -c conda-forge \ |
|
pydub \ |
|
nltk \ |
|
mecab-python3 \ |
|
&& pip install --no-cache-dir \ |
|
bs4 \ |
|
beautifulsoup4 \ |
|
ebooklib \ |
|
tqdm \ |
|
tts==0.21.3 \ |
|
unidic \ |
|
gradio |
|
|
|
|
|
RUN python -m unidic download |
|
|
|
|
|
WORKDIR /ebook2audiobookXTTS |
|
|
|
|
|
RUN git clone https://github.com/DrewThomasson/ebook2audiobookXTTS.git . |
|
|
|
|
|
COPY default_voice.wav /ebook2audiobookXTTS/ |
|
|
|
|
|
RUN echo "import torch" > /tmp/script1.py && \ |
|
echo "from TTS.api import TTS" >> /tmp/script1.py && \ |
|
echo "device = 'cuda' if torch.cuda.is_available() else 'cpu'" >> /tmp/script1.py && \ |
|
echo "print(TTS().list_models())" >> /tmp/script1.py && \ |
|
echo "tts = TTS('tts_models/multilingual/multi-dataset/xtts_v2').to(device)" >> /tmp/script1.py && \ |
|
echo "wav = tts.tts(text='Hello world!', speaker_wav='default_voice.wav', language='en')" >> /tmp/script1.py && \ |
|
echo "tts.tts_to_file(text='Hello world!', speaker_wav='default_voice.wav', language='en', file_path='output.wav')" >> /tmp/script1.py && \ |
|
yes | python /tmp/script1.py |
|
|
|
|
|
RUN rm -f /ebook2audiobookXTTS/output.wav |
|
|
|
|
|
RUN ls -la /ebook2audiobookXTTS/ |
|
|
|
|
|
RUN if [ -f /ebook2audiobookXTTS/custom_model_ebook2audiobookXTTS_with_link_gradio.py ]; then echo "Script found."; else echo "Script not found."; exit 1; fi |
|
|
|
|
|
RUN sed -i 's/demo.launch(share=False)/demo.launch(share=True)/' /ebook2audiobookXTTS/custom_model_ebook2audiobookXTTS_with_link_gradio.py |
|
|
|
|
|
RUN python -m nltk.downloader punkt |
|
|
|
|
|
CMD ["conda", "run", "--no-capture-output", "-n", "ebookenv", "python", "/ebook2audiobookXTTS/custom_model_ebook2audiobookXTTS_with_link_gradio.py"] |
|
|
|
|