abogen
Advanced tools
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
| #!/usr/bin/env python3 | ||
| """Build PyPI package (wheel and sdist) to `dist` folder for abogen.""" | ||
| import subprocess | ||
| import os | ||
| import shutil | ||
| import tempfile | ||
| def main(): | ||
| script_dir = os.path.dirname(os.path.abspath(__file__)) | ||
| output_dir = os.path.join(script_dir, "dist") | ||
| print("🔧 abogen PyPI Package Builder") | ||
| print("=" * 40) | ||
| print(f"📁 Script directory: {script_dir}") | ||
| print(f"📦 Output directory: {output_dir}") | ||
| # Try to print package version if present | ||
| version = None | ||
| version_file = os.path.join(script_dir, "abogen", "VERSION") | ||
| if os.path.isfile(version_file): | ||
| try: | ||
| with open(version_file, "r", encoding="utf-8") as vf: | ||
| version = vf.read().strip() | ||
| except Exception: | ||
| version = None | ||
| if version: | ||
| print(f"🔖 Package version: {version}") | ||
| # Check if build module is installed, install if not | ||
| # Temporarily remove script_dir from sys.path to avoid importing local build.py | ||
| import sys | ||
| original_path = sys.path[:] | ||
| try: | ||
| sys.path = [p for p in sys.path if os.path.abspath(p) != script_dir] | ||
| import build | ||
| except ImportError: | ||
| print("📦 Installing build module...") | ||
| subprocess.run([sys.executable, "-m", "pip", "install", "build"], check=True) | ||
| finally: | ||
| sys.path = original_path | ||
| # Create output directory | ||
| print(f"📂 Preparing output directory: {output_dir}") | ||
| if os.path.exists(output_dir): | ||
| shutil.rmtree(output_dir) | ||
| os.makedirs(output_dir, exist_ok=True) | ||
| print("🏗️ Building PyPI package...") | ||
| print(" Using temporary directory to avoid module conflicts...") | ||
| # Run from temp directory to avoid local build.py shadowing the build module | ||
| with tempfile.TemporaryDirectory() as tmpdir: | ||
| print(f" Temp directory: {tmpdir}") | ||
| print(" Running: python -m build -o <output_dir> <source_dir>") | ||
| result = subprocess.run( | ||
| [sys.executable, "-m", "build", "-o", output_dir, script_dir], | ||
| check=False, | ||
| cwd=tmpdir, | ||
| ) | ||
| print("\n" + "=" * 40) | ||
| if result.returncode == 0: | ||
| print("✅ Build successful!") | ||
| print(f"📦 Files created in {output_dir}:") | ||
| files = os.listdir(output_dir) | ||
| if files: | ||
| for f in files: | ||
| file_path = os.path.join(output_dir, f) | ||
| size = os.path.getsize(file_path) | ||
| print(f" 📄 {f} ({size:,} bytes)") | ||
| else: | ||
| print(" (No files found)") | ||
| print("\n🚀 Ready for upload with:\n") | ||
| print(" - To test on Test PyPI:") | ||
| print(f" python -m twine upload --repository testpypi {output_dir}/*") | ||
| print("\n - To upload to PyPI (when ready):") | ||
| print(f" python -m twine upload {output_dir}/*") | ||
| else: | ||
| print("❌ Build failed!") | ||
| print(f" Exit code: {result.returncode}") | ||
| sys.exit(result.returncode) | ||
| if __name__ == "__main__": | ||
| main() |
+25
-2
@@ -6,3 +6,5 @@ import os | ||
| import signal | ||
| from abogen.utils import get_resource_path, load_config, prevent_sleep_end | ||
| # Fix PyTorch DLL loading issue ([WinError 1114]) on Windows before importing PyQt6 | ||
@@ -25,2 +27,3 @@ if platform.system() == "Windows": | ||
| # Qt platform plugin detection (fixes #59) | ||
@@ -47,2 +50,24 @@ try: | ||
| # Pre-load "libxcb-cursor" on Linux (fixes #101) | ||
| if platform.system() == "Linux": | ||
| arch = platform.machine().lower() | ||
| lib_filename = {"x86_64": "libxcb-cursor-amd64.so.0", "amd64": "libxcb-cursor-amd64.so.0", "aarch64": "libxcb-cursor-arm64.so.0", "arm64": "libxcb-cursor-arm64.so.0"}.get(arch) | ||
| if lib_filename: | ||
| import ctypes | ||
| try: | ||
| # Try to load the system libxcb-cursor.so.0 first | ||
| ctypes.CDLL('libxcb-cursor.so.0', mode=ctypes.RTLD_GLOBAL) | ||
| except OSError: | ||
| # System lib not available, load the bundled version | ||
| lib_path = get_resource_path('abogen.libs', lib_filename) | ||
| if lib_path: | ||
| try: | ||
| ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL) | ||
| except OSError: | ||
| # If it fails (e.g. wrong glibc version on very old systems), | ||
| # we simply ignore it and hope the system has the library. | ||
| pass | ||
| # Set application ID for Windows taskbar icon | ||
@@ -70,4 +95,2 @@ if platform.system() == "Windows": | ||
| from abogen.utils import get_resource_path, load_config, prevent_sleep_end | ||
| # Set Hugging Face Hub environment variables | ||
@@ -74,0 +97,0 @@ os.environ["HF_HUB_DISABLE_TELEMETRY"] = "1" # Disable Hugging Face telemetry |
@@ -18,2 +18,3 @@ # a simple window with a list of items in the queue, no checkboxes | ||
| QAbstractItemView, | ||
| QCheckBox, | ||
| ) | ||
@@ -24,4 +25,19 @@ from PyQt6.QtCore import QFileInfo, Qt | ||
| from PyQt6.QtGui import QFontMetrics | ||
| from abogen.utils import load_config, save_config | ||
| # Define attributes that are safe to override with global settings | ||
| OVERRIDE_FIELDS = [ | ||
| "lang_code", | ||
| "speed", | ||
| "voice", | ||
| "save_option", | ||
| "output_folder", | ||
| "subtitle_mode", | ||
| "output_format", | ||
| "replace_single_newlines", | ||
| "use_silent_gaps", | ||
| "subtitle_speed_method", | ||
| ] | ||
| class ElidedLabel(QLabel): | ||
@@ -154,2 +170,4 @@ def __init__(self, text): | ||
| self.parent = parent | ||
| self.config = load_config() # Load config for persistence | ||
| layout = QVBoxLayout() | ||
@@ -171,4 +189,4 @@ layout.setContentsMargins(15, 15, 15, 15) # set main layout margins | ||
| "To add PDF, EPUB or markdown files, use the input box in the main window and click the <b>'Add to Queue'</b> button. " | ||
| "Each file in the queue keeps the configuration settings active when it was added. " | ||
| "Changing the main window configuration afterward <b>does not</b> affect files already in the queue. " | ||
| "By default, each file in the queue keeps the configuration settings active when they were added. " | ||
| "Enabling the <b>'Override item settings with current selection'</b> option below will force all items to use the configuration currently selected in the main window. " | ||
| "You can view each file's configuration by hovering over them." | ||
@@ -178,4 +196,17 @@ ) | ||
| instructions.setWordWrap(True) | ||
| instructions.setStyleSheet("margin-bottom: 8px;") | ||
| layout.addWidget(instructions) | ||
| # Override Checkbox | ||
| self.override_chk = QCheckBox("Override item settings with current selection") | ||
| self.override_chk.setToolTip( | ||
| "If checked, all items in the queue will be processed using the \n" | ||
| "settings currently selected in the main window, ignoring their saved state." | ||
| ) | ||
| # Load saved state (default to False) | ||
| self.override_chk.setChecked(self.config.get("queue_override_settings", False)) | ||
| # Trigger process_queue to update tooltips immediately when toggled | ||
| self.override_chk.stateChanged.connect(self.process_queue) | ||
| self.override_chk.setStyleSheet("margin-bottom: 8px;") | ||
| layout.addWidget(self.override_chk) | ||
| # Overlay label for empty queue | ||
@@ -253,4 +284,17 @@ self.empty_overlay = QLabel( | ||
| self.empty_overlay.hide() | ||
| # Get current global settings and checkbox state for overrides | ||
| current_global_settings = self.get_current_attributes() | ||
| is_override_active = self.override_chk.isChecked() | ||
| icon_provider = QFileIconProvider() | ||
| for item in self.queue: | ||
| # Dynamic Attribute Retrieval Helper | ||
| def get_val(attr, default=""): | ||
| # If override is ON and attr is overrideable, use global setting | ||
| if is_override_active and attr in OVERRIDE_FIELDS: | ||
| return current_global_settings.get(attr, default) | ||
| # Otherwise return the item's saved attribute | ||
| return getattr(item, attr, default) | ||
| # Determine display file path (prefer save_base_path for original file) | ||
@@ -280,4 +324,10 @@ display_file_path = getattr(item, "save_base_path", None) or item.file_name | ||
| list_item = QListWidgetItem() | ||
| # Set tooltip with detailed info | ||
| output_folder = getattr(item, "output_folder", "") | ||
| # Tooltip Generation | ||
| tooltip = "" | ||
| # If override is active, add the warning header on its own line | ||
| if is_override_active: | ||
| tooltip += "<b style='color: #ff9900;'>(Global Override Active)</b><br>" | ||
| output_folder = get_val("output_folder") | ||
| # For plain .txt inputs we don't need to show a separate processing file | ||
@@ -293,3 +343,3 @@ show_processing = True | ||
| tooltip = f"<b>Input File:</b> {display_file_path}<br>" | ||
| tooltip += f"<b>Input File:</b> {display_file_path}<br>" | ||
| if ( | ||
@@ -301,7 +351,8 @@ show_processing | ||
| tooltip += f"<b>Processing File:</b> {processing_file_path}<br>" | ||
| tooltip += ( | ||
| f"<b>Language:</b> {getattr(item, 'lang_code', '')}<br>" | ||
| f"<b>Speed:</b> {getattr(item, 'speed', '')}<br>" | ||
| f"<b>Voice:</b> {getattr(item, 'voice', '')}<br>" | ||
| f"<b>Save Option:</b> {getattr(item, 'save_option', '')}<br>" | ||
| f"<b>Language:</b> {get_val('lang_code')}<br>" | ||
| f"<b>Speed:</b> {get_val('speed')}<br>" | ||
| f"<b>Voice:</b> {get_val('voice')}<br>" | ||
| f"<b>Save Option:</b> {get_val('save_option')}<br>" | ||
| ) | ||
@@ -311,10 +362,10 @@ if output_folder not in (None, "", "None"): | ||
| tooltip += ( | ||
| f"<b>Subtitle Mode:</b> {getattr(item, 'subtitle_mode', '')}<br>" | ||
| f"<b>Output Format:</b> {getattr(item, 'output_format', '')}<br>" | ||
| f"<b>Subtitle Mode:</b> {get_val('subtitle_mode')}<br>" | ||
| f"<b>Output Format:</b> {get_val('output_format')}<br>" | ||
| f"<b>Characters:</b> {getattr(item, 'total_char_count', '')}<br>" | ||
| f"<b>Replace Single Newlines:</b> {getattr(item, 'replace_single_newlines', False)}<br>" | ||
| f"<b>Use Silent Gaps:</b> {getattr(item, 'use_silent_gaps', False)}<br>" | ||
| f"<b>Speed Method:</b> {getattr(item, 'subtitle_speed_method', 'tts')}" | ||
| f"<b>Replace Single Newlines:</b> {get_val('replace_single_newlines', True)}<br>" | ||
| f"<b>Use Silent Gaps:</b> {get_val('use_silent_gaps', False)}<br>" | ||
| f"<b>Speed Method:</b> {get_val('subtitle_speed_method', 'tts')}" | ||
| ) | ||
| # Add book handler options if present | ||
| # Add book handler options if present (Preserve logic: specific to file structure) | ||
| save_chapters_separately = getattr(item, "save_chapters_separately", None) | ||
@@ -428,3 +479,3 @@ merge_chapters_at_end = getattr(item, "merge_chapters_at_end", None) | ||
| attrs["replace_single_newlines"] = getattr( | ||
| parent, "replace_single_newlines", False | ||
| parent, "replace_single_newlines", True | ||
| ) | ||
@@ -515,4 +566,4 @@ # use_silent_gaps | ||
| == getattr(item, "total_char_count", None) | ||
| and getattr(queued_item, "replace_single_newlines", False) | ||
| == getattr(item, "replace_single_newlines", False) | ||
| and getattr(queued_item, "replace_single_newlines", True) | ||
| == getattr(item, "replace_single_newlines", True) | ||
| and getattr(queued_item, "use_silent_gaps", False) | ||
@@ -546,3 +597,2 @@ == getattr(item, "use_silent_gaps", False) | ||
| from PyQt6.QtWidgets import QFileDialog | ||
| from abogen.utils import calculate_text_length # import the function | ||
@@ -790,3 +840,6 @@ # Allow .txt, .srt, .ass, and .vtt files | ||
| def accept(self): | ||
| # Accept: keep changes | ||
| # Save the override state to config so it persists globally | ||
| self.config["queue_override_settings"] = self.override_chk.isChecked() | ||
| save_config(self.config) | ||
| super().accept() | ||
@@ -793,0 +846,0 @@ |
@@ -16,3 +16,3 @@ # represents a queued item - book, chapters, voice, etc. | ||
| total_char_count: int | ||
| replace_single_newlines: bool = False | ||
| replace_single_newlines: bool = True | ||
| use_silent_gaps: bool = False | ||
@@ -19,0 +19,0 @@ subtitle_speed_method: str = "tts" |
@@ -80,9 +80,14 @@ """ | ||
| log(f"\nLoading spaCy model '{model_name}'...") | ||
| # sentence segmentation involving parentheses, quotes, and complex structure. | ||
| # We only disable heavier components we don't need like NER. | ||
| nlp = spacy.load( | ||
| model_name, | ||
| disable=["ner", "parser", "tagger", "lemmatizer", "attribute_ruler"], | ||
| disable=["ner", "tagger", "lemmatizer", "attribute_ruler"], | ||
| ) | ||
| # Enable sentence segmentation only | ||
| if "sentencizer" not in nlp.pipe_names: | ||
| # Ensure a sentence segmentation strategy is in place | ||
| # The parser provides sents, but if it's missing (unlikely for core models), fallback to sentencizer | ||
| if "parser" not in nlp.pipe_names and "sentencizer" not in nlp.pipe_names: | ||
| nlp.add_pipe("sentencizer") | ||
| _nlp_cache[lang_code] = nlp | ||
@@ -97,9 +102,10 @@ return nlp | ||
| download(model_name) | ||
| # Retry loading | ||
| # Retry loading with the same fix | ||
| nlp = spacy.load( | ||
| model_name, | ||
| disable=["ner", "parser", "tagger", "lemmatizer", "attribute_ruler"], | ||
| disable=["ner", "tagger", "lemmatizer", "attribute_ruler"], | ||
| ) | ||
| if "sentencizer" not in nlp.pipe_names: | ||
| if "parser" not in nlp.pipe_names and "sentencizer" not in nlp.pipe_names: | ||
| nlp.add_pipe("sentencizer") | ||
| _nlp_cache[lang_code] = nlp | ||
@@ -106,0 +112,0 @@ log(f"spaCy model '{model_name}' downloaded and loaded") |
+1
-1
@@ -136,3 +136,3 @@ import os | ||
| cfg = load_config() | ||
| replace_single_newlines = cfg.get("replace_single_newlines", False) | ||
| replace_single_newlines = cfg.get("replace_single_newlines", True) | ||
| # Collapse all whitespace (excluding newlines) into single spaces per line and trim edges | ||
@@ -139,0 +139,0 @@ # Use pre-compiled pattern for better performance |
+1
-1
@@ -1,1 +0,1 @@ | ||
| 1.2.4 | ||
| 1.2.5 |
+10
-1
@@ -1,2 +0,11 @@ | ||
| # 1.2.4 (Pre-release) | ||
| # 1.2.5 | ||
| - Added new option: `Override item settings with current selection` in the queue manager. When enabled, all items in the queue will be processed using the current global settings selected in the main GUI, overriding their individual settings. When disabled, each item will retain its own specific settings. | ||
| - Fixed `Error "Could not load the Qt platform plugin "xcb"` error that occurred in some Linux distributions due to missing `libxcb-cursor0` library by conditionally loading the bundled library when the system version is unavailable, issue mentioned by @bmcgonag in #101. | ||
| - Fixed the `No module named pip` error that occurred for users who installed Abogen via the [**uv**](https://github.com/astral-sh/uv) installer. | ||
| - Fixed defaults for `replace_single_newlines` not being applied correctly in some cases. | ||
| - Fixed `Save chapters separately for queued epubs is ignored`, issue mentioned by @dymas-cz in #109. | ||
| - Fixed incorrect sentence segmentation when using spaCy, where text would erroneously split after opening parentheses. | ||
| - Improvements in code and documentation. | ||
| # 1.2.4 | ||
| - **Subtitle generation is now available for all languages!** Abogen now supports subtitle generation for non-English languages using audio duration-based timing. Available modes include `Line`, `Sentence`, and `Sentence + Comma`. (Note: Word-level subtitle modes remain English-only due to Kokoro's timestamp token limitations.) | ||
@@ -3,0 +12,0 @@ - New option: **"Use spaCy for sentence segmentation"** You can now use [spaCy](https://spacy.io/) to automatically detect sentence boundaries and produce cleaner, more readable subtitles. Quick summary: |
+106
-23
| Metadata-Version: 2.4 | ||
| Name: abogen | ||
| Version: 1.2.4 | ||
| Version: 1.2.5 | ||
| Summary: Generate audiobooks from EPUBs, PDFs and text with synchronized captions. | ||
@@ -30,2 +30,3 @@ Project-URL: Homepage, https://github.com/denizsafak/abogen | ||
| Requires-Dist: misaki[zh]>=0.9.4 | ||
| Requires-Dist: pip | ||
| Requires-Dist: platformdirs>=4.3.7 | ||
@@ -38,2 +39,11 @@ Requires-Dist: pygame>=2.6.1 | ||
| Requires-Dist: static-ffmpeg>=2.13 | ||
| Provides-Extra: cuda | ||
| Requires-Dist: torch; extra == 'cuda' | ||
| Provides-Extra: cuda126 | ||
| Requires-Dist: torch; extra == 'cuda126' | ||
| Provides-Extra: cuda130 | ||
| Requires-Dist: torch; extra == 'cuda130' | ||
| Provides-Extra: rocm | ||
| Requires-Dist: pytorch-triton-rocm; extra == 'rocm' | ||
| Requires-Dist: torch; extra == 'rocm' | ||
| Description-Content-Type: text/markdown | ||
@@ -64,6 +74,6 @@ | ||
| ### Windows | ||
| ### `Windows` | ||
| Go to [espeak-ng latest release](https://github.com/espeak-ng/espeak-ng/releases/latest) download and run the *.msi file. | ||
| #### OPTION 1: Install using script | ||
| #### <b>OPTION 1: Install using script</b> | ||
| 1. [Download](https://github.com/denizsafak/abogen/archive/refs/heads/main.zip) the repository | ||
@@ -78,4 +88,23 @@ 2. Extract the ZIP file | ||
| #### OPTION 2: Install using pip | ||
| #### <b>OPTION 2: Install using uv</b> | ||
| First, [install uv](https://docs.astral.sh/uv/getting-started/installation/) if you haven't already. | ||
| ```bash | ||
| # For NVIDIA GPUs (CUDA 12.8) - Recommended | ||
| uv tool install --python 3.12 abogen[cuda] | ||
| # For NVIDIA GPUs (CUDA 12.6) - Older drivers | ||
| uv tool install --python 3.12 abogen[cuda126] | ||
| # For NVIDIA GPUs (CUDA 13.0) - Newer drivers | ||
| uv tool install --python 3.12 abogen[cuda130] | ||
| # For AMD GPUs or without GPU (CPU) - ROCm is not available on Windows. Use Linux if you have AMD GPU | ||
| uv tool install --python 3.12 abogen | ||
| ``` | ||
| <details> | ||
| <summary><b>Alternative: Install using pip (click to expand)</b></summary> | ||
| ```bash | ||
| # Create a virtual environment (optional) | ||
@@ -97,3 +126,8 @@ mkdir abogen && cd abogen | ||
| ### Mac | ||
| </details> | ||
| ### `Mac` | ||
| First, [install uv](https://docs.astral.sh/uv/getting-started/installation/) if you haven't already. | ||
| ```bash | ||
@@ -103,2 +137,13 @@ # Install espeak-ng | ||
| # Install abogen (Automatically handles Silicon Mac/MPS support) | ||
| uv tool install --python 3.12 abogen | ||
| ``` | ||
| <details> | ||
| <summary><b>Alternative: Install using pip (click to expand)</b></summary> | ||
| ```bash | ||
| # Install espeak-ng | ||
| brew install espeak-ng | ||
| # Create a virtual environment (recommended) | ||
@@ -116,3 +161,9 @@ mkdir abogen && cd abogen | ||
| ``` | ||
| ### Linux | ||
| </details> | ||
| ### `Linux` | ||
| First, [install uv](https://docs.astral.sh/uv/getting-started/installation/) if you haven't already. | ||
| ```bash | ||
@@ -124,2 +175,18 @@ # Install espeak-ng | ||
| # For NVIDIA GPUs or without GPU (CPU) - No need to include [CUDA] in here. | ||
| uv tool install --python 3.12 abogen | ||
| # For AMD GPUs (ROCm 6.4) | ||
| uv tool install --python 3.12 abogen[rocm] | ||
| ``` | ||
| <details> | ||
| <summary><b>Alternative: Install using pip (click to expand)</b></summary> | ||
| ```bash | ||
| # Install espeak-ng | ||
| sudo apt install espeak-ng # Ubuntu/Debian | ||
| sudo pacman -S espeak-ng # Arch Linux | ||
| sudo dnf install espeak-ng # Fedora | ||
| # Create a virtual environment (recommended) | ||
@@ -141,3 +208,5 @@ mkdir abogen && cd abogen | ||
| ``` | ||
| </details> | ||
| > See [How to fix "CUDA GPU is not available. Using CPU" warning?](#cuda-warning) | ||
@@ -151,9 +220,8 @@ | ||
| > See [How to use "uv" instead of "pip"?](#use-uv-instead-of-pip) | ||
| > Special thanks to [@hg000125](https://github.com/hg000125) for his contribution in [#23](https://github.com/denizsafak/abogen/issues/23). AMD GPU support is possible thanks to his work. | ||
| ## `How to run?` | ||
| If you installed using pip, you can simply run the following command to start Abogen: | ||
| You can simply run this command to start Abogen: | ||
| ```bash | ||
@@ -242,4 +310,5 @@ abogen | ||
| - You can add text files (`.txt`) directly using the **Add files** button in the Queue Manager. To add PDF, EPUB, or markdown files, use the input box in the main window and click the **Add to Queue** button. | ||
| - You can add text files (`.txt`) and subtitle files (`.srt`, `.ass`, `.vtt`) directly using the **Add files** button in the Queue Manager or by dragging and dropping them into the queue list. To add PDF, EPUB, or markdown files, use the input box in the main window and click the **Add to Queue** button. | ||
| - Each file in the queue keeps the configuration settings that were active when it was added. Changing the main window configuration afterward does **not** affect files already in the queue. | ||
| - You can enable the **Override item settings with current selection** option to force all items in the queue to use the configuration currently selected in the main window, overriding their saved settings. | ||
| - You can view each file's configuration by hovering over them. | ||
@@ -379,2 +448,13 @@ | ||
| ## `🌐 Web Application` | ||
| A web-based version of Abogen has been developed by [@jeremiahsb](https://github.com/jeremiahsb). | ||
| **Access the repository here:** [jeremiahsb/abogen](https://github.com/jeremiahsb/abogen) | ||
| > [!NOTE] | ||
| > I intend to merge this implementation into the main repository in the future once existing conflicts are resolved. Until then, please be aware that the web version is maintained independently and may not always be in sync with the latest updates in this repository. | ||
| > Special thanks to [@jeremiahsb](https://github.com/jeremiahsb) for implementing the web app! | ||
| ## `Similar Projects` | ||
@@ -441,2 +521,11 @@ Abogen is a standalone project, but it is inspired by and shares some similarities with other projects. Here are a few: | ||
| > If you have an AMD GPU, you need to use Linux and follow the Linux/ROCm [instructions](#linux). If you want to keep running on CPU, no action is required, but performance will just be reduced. See [#32](https://github.com/denizsafak/abogen/issues/32) for more details. | ||
| > | ||
| > If you used `uv` to install Abogen, you can uninstall and try reinstalling with another CUDA version: | ||
| > ```bash | ||
| > uv tool uninstall abogen | ||
| > # First, try CUDA 13.0 for newer drivers | ||
| > uv tool install --python 3.12 abogen[cuda130] | ||
| > # If that doesn't work, try CUDA 12.6 for older drivers | ||
| > uv tool install --python 3.12 abogen[cuda126] | ||
| > ``` | ||
@@ -460,3 +549,3 @@ </details> | ||
| > Try installing Abogen on supported Python (3.10 to 3.12) versions. You can use [pyenv](https://github.com/pyenv/pyenv) to manage multiple Python versions easily in Linux. Watch this [video](https://www.youtube.com/watch?v=MVyb-nI4KyI) by NetworkChuck for a quick guide. | ||
| > Try installing Abogen on supported Python (3.10 to 3.12) versions. I recommend installing with [uv](https://docs.astral.sh/uv/getting-started/installation/). You can also use [pyenv](https://github.com/pyenv/pyenv) to manage multiple Python versions easily on Linux. Watch this [video](https://www.youtube.com/watch?v=MVyb-nI4KyI) by NetworkChuck for a quick guide. | ||
@@ -491,14 +580,2 @@ </details> | ||
| <details><summary><b> | ||
| <a name="use-uv-instead-of-pip">How to use "uv" instead of "pip"?</a> | ||
| </b></summary> | ||
| > Abogen needs "pip", because Kokoro uses pip to download voice models from HuggingFace Hub. If you want to use "uv" instead of "pip", you can use the following command to run Abogen: | ||
| > | ||
| > ```bash | ||
| > uvx --with pip abogen | ||
| > ``` | ||
| </details> | ||
| <details><summary><b> | ||
| <a name="use-uv-instead-of-pip">How to uninstall Abogen?</a> | ||
@@ -514,2 +591,7 @@ </b></summary> | ||
| >``` | ||
| >- If you installed Abogen using uv, type: | ||
| >```bash | ||
| >uv tool uninstall abogen # uninstalls abogen | ||
| >uv cache clear # removes uv cache | ||
| >``` | ||
| > - If you installed Abogen using the Windows installer (WINDOWS_INSTALL.bat), just remove the folder that contains Abogen. It installs everything inside `python_embedded` folder, no other directories are created. | ||
@@ -522,2 +604,3 @@ > - If you installed espeak-ng, you need to remove it separately. | ||
| I welcome contributions! If you have ideas for new features, improvements, or bug fixes, please fork the repository and submit a pull request. | ||
| ### For developers and contributors | ||
@@ -524,0 +607,0 @@ If you'd like to modify the code and contribute to development, you can [download the repository](https://github.com/denizsafak/abogen/archive/refs/heads/main.zip), extract it and run the following commands to build **or** install the package: |
+76
-1
@@ -16,2 +16,3 @@ [build-system] | ||
| dependencies = [ | ||
| "pip", | ||
| "PyQt6>=6.10.0", | ||
@@ -73,2 +74,76 @@ "kokoro>=0.9.4", | ||
| path = "abogen/VERSION" | ||
| pattern = "^(?P<version>.+)$" | ||
| pattern = "^(?P<version>.+)$" | ||
| # --- OPTIONAL DEPENDENCIES --- | ||
| [project.optional-dependencies] | ||
| # NVIDIA GPU (Windows) (CUDA 12.6) # uv tool install abogen[cuda126] | ||
| cuda126 = ["torch"] | ||
| # NVIDIA GPU (Windows) (CUDA 12.8) # uv tool install abogen[cuda] | ||
| cuda = ["torch"] | ||
| # NVIDIA GPU (Windows) (CUDA 13.0) # uv tool install abogen[cuda130] | ||
| cuda130 = ["torch"] | ||
| # AMD GPU (Linux) (ROCm 6.4) # uv tool install abogen[rocm] | ||
| rocm = ["torch", "pytorch-triton-rocm"] | ||
| # --- KOKORO CONFIGURATION (for macOS) --- | ||
| [tool.uv.sources] | ||
| kokoro = [ | ||
| { git = "https://github.com/hexgrad/kokoro.git", marker = "sys_platform == 'darwin'" }, | ||
| { index = "pypi", marker = "sys_platform != 'darwin'" } | ||
| ] | ||
| # --- TORCH CONFIGURATION --- | ||
| torch = [ | ||
| # ROCm 6.4 Nightly (AMD) | ||
| { index = "pytorch-rocm-64-nightly", marker = "extra == 'rocm'" }, | ||
| # CUDA 13.0 (NVIDIA) | ||
| { index = "pytorch-cuda-130", marker = "extra == 'cuda130' and extra != 'rocm'" }, | ||
| # CUDA 12.6 (NVIDIA) | ||
| { index = "pytorch-cuda-126", marker = "extra == 'cuda126' and extra != 'rocm' and extra != 'cuda130'" }, | ||
| # CUDA 12.8 (NVIDIA) | ||
| { index = "pytorch-cuda-128", marker = "extra == 'cuda' and extra != 'rocm' and extra != 'cuda130' and extra != 'cuda126'" } | ||
| ] | ||
| # --- TRITON CONFIGURATION --- | ||
| pytorch-triton-rocm = [ | ||
| { index = "pytorch-rocm-64-nightly", marker = "extra == 'rocm'" } | ||
| ] | ||
| # --- INDEX DEFINITIONS --- | ||
| # PyPI Index | ||
| [[tool.uv.index]] | ||
| name = "pypi" | ||
| url = "https://pypi.org/simple" | ||
| default = true | ||
| # CUDA 12.6 Index | ||
| [[tool.uv.index]] | ||
| name = "pytorch-cuda-126" | ||
| url = "https://download.pytorch.org/whl/cu126" | ||
| explicit = true | ||
| # CUDA 12.8 Index | ||
| [[tool.uv.index]] | ||
| name = "pytorch-cuda-128" | ||
| url = "https://download.pytorch.org/whl/cu128" | ||
| explicit = true | ||
| # CUDA 13.0 Index | ||
| [[tool.uv.index]] | ||
| name = "pytorch-cuda-130" | ||
| url = "https://download.pytorch.org/whl/cu130" | ||
| explicit = true | ||
| # ROCm 6.4 Nightly Index | ||
| [[tool.uv.index]] | ||
| name = "pytorch-rocm-64-nightly" | ||
| url = "https://download.pytorch.org/whl/nightly/rocm6.4" | ||
| explicit = true |
+95
-22
@@ -24,6 +24,6 @@ # abogen <img width="40px" title="abogen icon" src="https://raw.githubusercontent.com/denizsafak/abogen/refs/heads/main/abogen/assets/icon.ico" align="right" style="padding-left: 10px; padding-top:5px;"> | ||
| ### Windows | ||
| ### `Windows` | ||
| Go to [espeak-ng latest release](https://github.com/espeak-ng/espeak-ng/releases/latest) download and run the *.msi file. | ||
| #### OPTION 1: Install using script | ||
| #### <b>OPTION 1: Install using script</b> | ||
| 1. [Download](https://github.com/denizsafak/abogen/archive/refs/heads/main.zip) the repository | ||
@@ -38,4 +38,23 @@ 2. Extract the ZIP file | ||
| #### OPTION 2: Install using pip | ||
| #### <b>OPTION 2: Install using uv</b> | ||
| First, [install uv](https://docs.astral.sh/uv/getting-started/installation/) if you haven't already. | ||
| ```bash | ||
| # For NVIDIA GPUs (CUDA 12.8) - Recommended | ||
| uv tool install --python 3.12 abogen[cuda] | ||
| # For NVIDIA GPUs (CUDA 12.6) - Older drivers | ||
| uv tool install --python 3.12 abogen[cuda126] | ||
| # For NVIDIA GPUs (CUDA 13.0) - Newer drivers | ||
| uv tool install --python 3.12 abogen[cuda130] | ||
| # For AMD GPUs or without GPU (CPU) - ROCm is not available on Windows. Use Linux if you have AMD GPU | ||
| uv tool install --python 3.12 abogen | ||
| ``` | ||
| <details> | ||
| <summary><b>Alternative: Install using pip (click to expand)</b></summary> | ||
| ```bash | ||
| # Create a virtual environment (optional) | ||
@@ -57,3 +76,8 @@ mkdir abogen && cd abogen | ||
| ### Mac | ||
| </details> | ||
| ### `Mac` | ||
| First, [install uv](https://docs.astral.sh/uv/getting-started/installation/) if you haven't already. | ||
| ```bash | ||
@@ -63,2 +87,13 @@ # Install espeak-ng | ||
| # Install abogen (Automatically handles Silicon Mac/MPS support) | ||
| uv tool install --python 3.12 abogen | ||
| ``` | ||
| <details> | ||
| <summary><b>Alternative: Install using pip (click to expand)</b></summary> | ||
| ```bash | ||
| # Install espeak-ng | ||
| brew install espeak-ng | ||
| # Create a virtual environment (recommended) | ||
@@ -76,3 +111,9 @@ mkdir abogen && cd abogen | ||
| ``` | ||
| ### Linux | ||
| </details> | ||
| ### `Linux` | ||
| First, [install uv](https://docs.astral.sh/uv/getting-started/installation/) if you haven't already. | ||
| ```bash | ||
@@ -84,2 +125,18 @@ # Install espeak-ng | ||
| # For NVIDIA GPUs or without GPU (CPU) - No need to include [CUDA] in here. | ||
| uv tool install --python 3.12 abogen | ||
| # For AMD GPUs (ROCm 6.4) | ||
| uv tool install --python 3.12 abogen[rocm] | ||
| ``` | ||
| <details> | ||
| <summary><b>Alternative: Install using pip (click to expand)</b></summary> | ||
| ```bash | ||
| # Install espeak-ng | ||
| sudo apt install espeak-ng # Ubuntu/Debian | ||
| sudo pacman -S espeak-ng # Arch Linux | ||
| sudo dnf install espeak-ng # Fedora | ||
| # Create a virtual environment (recommended) | ||
@@ -101,3 +158,5 @@ mkdir abogen && cd abogen | ||
| ``` | ||
| </details> | ||
| > See [How to fix "CUDA GPU is not available. Using CPU" warning?](#cuda-warning) | ||
@@ -111,9 +170,8 @@ | ||
| > See [How to use "uv" instead of "pip"?](#use-uv-instead-of-pip) | ||
| > Special thanks to [@hg000125](https://github.com/hg000125) for his contribution in [#23](https://github.com/denizsafak/abogen/issues/23). AMD GPU support is possible thanks to his work. | ||
| ## `How to run?` | ||
| If you installed using pip, you can simply run the following command to start Abogen: | ||
| You can simply run this command to start Abogen: | ||
| ```bash | ||
@@ -202,4 +260,5 @@ abogen | ||
| - You can add text files (`.txt`) directly using the **Add files** button in the Queue Manager. To add PDF, EPUB, or markdown files, use the input box in the main window and click the **Add to Queue** button. | ||
| - You can add text files (`.txt`) and subtitle files (`.srt`, `.ass`, `.vtt`) directly using the **Add files** button in the Queue Manager or by dragging and dropping them into the queue list. To add PDF, EPUB, or markdown files, use the input box in the main window and click the **Add to Queue** button. | ||
| - Each file in the queue keeps the configuration settings that were active when it was added. Changing the main window configuration afterward does **not** affect files already in the queue. | ||
| - You can enable the **Override item settings with current selection** option to force all items in the queue to use the configuration currently selected in the main window, overriding their saved settings. | ||
| - You can view each file's configuration by hovering over them. | ||
@@ -339,2 +398,13 @@ | ||
| ## `🌐 Web Application` | ||
| A web-based version of Abogen has been developed by [@jeremiahsb](https://github.com/jeremiahsb). | ||
| **Access the repository here:** [jeremiahsb/abogen](https://github.com/jeremiahsb/abogen) | ||
| > [!NOTE] | ||
| > I intend to merge this implementation into the main repository in the future once existing conflicts are resolved. Until then, please be aware that the web version is maintained independently and may not always be in sync with the latest updates in this repository. | ||
| > Special thanks to [@jeremiahsb](https://github.com/jeremiahsb) for implementing the web app! | ||
| ## `Similar Projects` | ||
@@ -401,2 +471,11 @@ Abogen is a standalone project, but it is inspired by and shares some similarities with other projects. Here are a few: | ||
| > If you have an AMD GPU, you need to use Linux and follow the Linux/ROCm [instructions](#linux). If you want to keep running on CPU, no action is required, but performance will just be reduced. See [#32](https://github.com/denizsafak/abogen/issues/32) for more details. | ||
| > | ||
| > If you used `uv` to install Abogen, you can uninstall and try reinstalling with another CUDA version: | ||
| > ```bash | ||
| > uv tool uninstall abogen | ||
| > # First, try CUDA 13.0 for newer drivers | ||
| > uv tool install --python 3.12 abogen[cuda130] | ||
| > # If that doesn't work, try CUDA 12.6 for older drivers | ||
| > uv tool install --python 3.12 abogen[cuda126] | ||
| > ``` | ||
@@ -420,3 +499,3 @@ </details> | ||
| > Try installing Abogen on supported Python (3.10 to 3.12) versions. You can use [pyenv](https://github.com/pyenv/pyenv) to manage multiple Python versions easily in Linux. Watch this [video](https://www.youtube.com/watch?v=MVyb-nI4KyI) by NetworkChuck for a quick guide. | ||
| > Try installing Abogen on supported Python (3.10 to 3.12) versions. I recommend installing with [uv](https://docs.astral.sh/uv/getting-started/installation/). You can also use [pyenv](https://github.com/pyenv/pyenv) to manage multiple Python versions easily on Linux. Watch this [video](https://www.youtube.com/watch?v=MVyb-nI4KyI) by NetworkChuck for a quick guide. | ||
@@ -451,14 +530,2 @@ </details> | ||
| <details><summary><b> | ||
| <a name="use-uv-instead-of-pip">How to use "uv" instead of "pip"?</a> | ||
| </b></summary> | ||
| > Abogen needs "pip", because Kokoro uses pip to download voice models from HuggingFace Hub. If you want to use "uv" instead of "pip", you can use the following command to run Abogen: | ||
| > | ||
| > ```bash | ||
| > uvx --with pip abogen | ||
| > ``` | ||
| </details> | ||
| <details><summary><b> | ||
| <a name="use-uv-instead-of-pip">How to uninstall Abogen?</a> | ||
@@ -474,2 +541,7 @@ </b></summary> | ||
| >``` | ||
| >- If you installed Abogen using uv, type: | ||
| >```bash | ||
| >uv tool uninstall abogen # uninstalls abogen | ||
| >uv cache clear # removes uv cache | ||
| >``` | ||
| > - If you installed Abogen using the Windows installer (WINDOWS_INSTALL.bat), just remove the folder that contains Abogen. It installs everything inside `python_embedded` folder, no other directories are created. | ||
@@ -482,2 +554,3 @@ > - If you installed espeak-ng, you need to remove it separately. | ||
| I welcome contributions! If you have ideas for new features, improvements, or bug fixes, please fork the repository and submit a pull request. | ||
| ### For developers and contributors | ||
@@ -484,0 +557,0 @@ If you'd like to modify the code and contribute to development, you can [download the repository](https://github.com/denizsafak/abogen/archive/refs/heads/main.zip), extract it and run the following commands to build **or** install the package: |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
903383
8.12%44
10%12077
1.86%