drewThomasson commited on
Commit
14803d8
β€’
1 Parent(s): af9175b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +172 -1
README.md CHANGED
@@ -10,4 +10,175 @@ pinned: false
10
  license: mit
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  license: mit
11
  ---
12
 
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
14
+
15
+
16
+
17
+
18
+
19
+
20
+ # πŸ“š ebook2audiobook
21
+
22
+ Convert eBooks to audiobooks with chapters and metadata using Calibre and Coqui XTTS. Supports optional voice cloning and multiple languages!
23
+
24
+ ## 🌟 Features
25
+
26
+ - πŸ“– Converts eBooks to text format with Calibre.
27
+ - πŸ“š Splits eBook into chapters for organized audio.
28
+ - πŸŽ™οΈ High-quality text-to-speech with Coqui XTTS.
29
+ - πŸ—£οΈ Optional voice cloning with your own voice file.
30
+ - 🌍 Supports multiple languages (English by default).
31
+ - πŸ–₯️ Designed to run on 4GB RAM.
32
+
33
+ ## πŸ› οΈ Requirements
34
+
35
+ - Python 3.x
36
+ - `coqui-tts` Python package
37
+ - Calibre (for eBook conversion)
38
+ - FFmpeg (for audiobook creation)
39
+ - Optional: Custom voice file for voice cloning
40
+
41
+ ### πŸ”§ Installation Instructions
42
+
43
+ 1. **Install Python 3.x** from [Python.org](https://www.python.org/downloads/).
44
+
45
+ 2. **Install Calibre**:
46
+ - **Ubuntu**: `sudo apt-get install -y calibre`
47
+ - **macOS**: `brew install calibre`
48
+ - **Windows** (Admin Powershell): `choco install calibre`
49
+
50
+ 3. **Install FFmpeg**:
51
+ - **Ubuntu**: `sudo apt-get install -y ffmpeg`
52
+ - **macOS**: `brew install ffmpeg`
53
+ - **Windows** (Admin Powershell): `choco install ffmpeg`
54
+
55
+ 4. **Optional: Install Mecab** (for non-Latin languages):
56
+ - **Ubuntu**: `sudo apt-get install -y mecab libmecab-dev mecab-ipadic-utf8`
57
+ - **macOS**: `brew install mecab`, `brew install mecab-ipadic`
58
+ - **Windows** (Admin Powershell): `choco install mecab` (Note: Japanese support is limited)
59
+
60
+ 5. **Install Python packages**:
61
+ ```bash
62
+ pip install tts==0.21.3 pydub nltk beautifulsoup4 ebooklib tqdm
63
+ ```
64
+
65
+ **For non-Latin languages**:
66
+ ```bash
67
+ python -m unidic download
68
+ pip install mecab mecab-python3 unidic
69
+ ```
70
+
71
+ ## 🌐 Supported Languages
72
+
73
+ - **English (en)**
74
+ - **Spanish (es)**
75
+ - **French (fr)**
76
+ - **German (de)**
77
+ - **Italian (it)**
78
+ - **Portuguese (pt)**
79
+ - **Polish (pl)**
80
+ - **Turkish (tr)**
81
+ - **Russian (ru)**
82
+ - **Dutch (nl)**
83
+ - **Czech (cs)**
84
+ - **Arabic (ar)**
85
+ - **Chinese (zh-cn)**
86
+ - **Japanese (ja)**
87
+ - **Hungarian (hu)**
88
+ - **Korean (ko)**
89
+
90
+ Specify the language code when running the script.
91
+
92
+ ## πŸš€ Usage
93
+
94
+ ### πŸ–₯️ Gradio Web Interface
95
+
96
+ 1. **Run the Script**:
97
+ ```bash
98
+ python custom_model_ebook2audiobookXTTS_gradio.py
99
+ ```
100
+
101
+ 2. **Open the Web App**: Click the URL provided in the terminal to access the web app and convert eBooks.
102
+
103
+ ### πŸ“ Basic Usage
104
+
105
+ ```bash
106
+ python ebook2audiobook.py <path_to_ebook_file> [path_to_voice_file] [language_code]
107
+ ```
108
+
109
+ - **<path_to_ebook_file>**: Path to your eBook file.
110
+ - **[path_to_voice_file]**: Optional for voice cloning.
111
+ - **[language_code]**: Optional to specify language.
112
+
113
+ ### 🧩 Custom XTTS Model
114
+
115
+ ```bash
116
+ python custom_model_ebook2audiobookXTTS.py <ebook_file_path> <target_voice_file_path> <language> <custom_model_path> <custom_config_path> <custom_vocab_path>
117
+ ```
118
+
119
+ - **<ebook_file_path>**: Path to your eBook file.
120
+ - **<target_voice_file_path>**: Optional for voice cloning.
121
+ - **<language>**: Optional to specify language.
122
+ - **<custom_model_path>**: Path to `model.pth`.
123
+ - **<custom_config_path>**: Path to `config.json`.
124
+ - **<custom_vocab_path>**: Path to `vocab.json`.
125
+
126
+ ### 🐳 Using Docker
127
+
128
+ You can also use Docker to run the eBook to Audiobook converter. This method ensures consistency across different environments and simplifies setup.
129
+
130
+ #### πŸš€ Running the Docker Container
131
+
132
+ To run the Docker container and start the Gradio interface, use the following command:
133
+
134
+ -Run with CPU only
135
+ ```powershell
136
+ docker run -it --rm -p 7860:7860 athomasson2/ebook2audiobookxtts:latest
137
+ ```
138
+ -Run with GPU Speedup (Nvida graphics cards only)
139
+ ```powershell
140
+ docker run -it --rm --gpus all -p 7860:7860 athomasson2/ebook2audiobookxtts:latest
141
+ ```
142
+
143
+ This command will start the Gradio interface on port 7860.(localhost:7860)
144
+
145
+ #### πŸ–₯️ Docker GUI
146
+
147
+ <img width="1401" alt="Screenshot 2024-08-25 at 10 08 40β€―AM" src="https://github.com/user-attachments/assets/78cfd33e-cd46-41cc-8128-3820160a5e40">
148
+ <img width="1406" alt="Screenshot 2024-08-25 at 10 08 51β€―AM" src="https://github.com/user-attachments/assets/dbfad9f6-e6e5-4cad-b248-adb76c5434f3">
149
+
150
+ ### πŸ› οΈ For Custom Xtts Models
151
+
152
+ Models built to be better at a specific voice. Check out my Hugging Face page [here](https://huggingface.co/drewThomasson).
153
+
154
+ To use a custom model, paste the link of the `Finished_model_files.zip` file like this:
155
+
156
+ [David Attenborough fine tuned Finished_model_files.zip](https://huggingface.co/drewThomasson/xtts_David_Attenborough_fine_tune/resolve/main/Finished_model_files.zip?download=true)
157
+
158
+
159
+
160
+
161
+ More details can be found at the [Dockerfile Hub Page]([https://github.com/DrewThomasson/ebook2audiobookXTTS](https://hub.docker.com/repository/docker/athomasson2/ebook2audiobookxtts/general)).
162
+
163
+ ## 🌐 Fine Tuned Xtts models
164
+
165
+ To find already fine-tuned XTTS models, visit [this Hugging Face link](https://huggingface.co/drewThomasson) 🌐. Search for models that include "xtts fine tune" in their names.
166
+
167
+ ## πŸŽ₯ Demos
168
+
169
+ https://github.com/user-attachments/assets/8486603c-38b1-43ce-9639-73757dfb1031
170
+
171
+ ## πŸ“š Supported eBook Formats
172
+
173
+ - `.epub`, `.pdf`, `.mobi`, `.txt`, `.html`, `.rtf`, `.chm`, `.lit`, `.pdb`, `.fb2`, `.odt`, `.cbr`, `.cbz`, `.prc`, `.lrf`, `.pml`, `.snb`, `.cbc`, `.rb`, `.tcr`
174
+ - **Best results**: `.epub` or `.mobi` for automatic chapter detection
175
+
176
+ ## πŸ“‚ Output
177
+
178
+ - Creates an `.m4b` file with metadata and chapters.
179
+ - **Example Output**: ![Example](https://github.com/DrewThomasson/VoxNovel/blob/dc5197dff97252fa44c391dc0596902d71278a88/readme_files/example_in_app.jpeg)
180
+
181
+ ## πŸ™ Special Thanks
182
+
183
+ - **Coqui TTS**: [Coqui TTS GitHub](https://github.com/coqui-ai/TTS)
184
+ - **Calibre**: [Calibre Website](https://calibre-ebook.com)