https://github.com/amanvirparhar/gempress
A script to fix basic typesetting & formatting issues in public domain eBooks.
https://github.com/amanvirparhar/gempress
ebook epub project-gutenberg
Last synced: 25 days ago
JSON representation
A script to fix basic typesetting & formatting issues in public domain eBooks.
- Host: GitHub
- URL: https://github.com/amanvirparhar/gempress
- Owner: amanvirparhar
- License: mit
- Created: 2025-02-12T23:16:26.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-02-17T06:10:29.000Z (3 months ago)
- Last Synced: 2025-05-07T11:58:41.873Z (25 days ago)
- Topics: ebook, epub, project-gutenberg
- Language: Python
- Homepage: https://amanvir.com/blog/gempress-formatting-ebooks-with-gemini
- Size: 182 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GemPress

A Python script that uses Google’s [Gemini-1.5-Flash](https://ai.google.dev/gemini-api/docs/models/gemini#gemini-1.5-flash) model to fix basic typesetting and formatting issues in public domain eBooks from [Project Gutenberg](https://www.gutenberg.org).
Learn more about GemPress by reading the accompanying [blog post](https://amanvir.com/blog/gempress-formatting-ebooks-with-gemini).
## Setup
1. Clone the repository, and `cd` into it:
```bash
git clone https://github.com/amanvirparhar/gempress
cd gempress
```
2. Create a .env file in this directory with the following contents:
```env
GEMINI_API_KEY=your_api_key_here
```
3. Install [`uv`](https://github.com/astral-sh/uv).## Usage
1. Put the raw text file of the book you want to reformat in the same directory as `main.py`.
2. Change the path to the text file in `main.py` to the name of the file you want to reformat.
3. Run the script:
```bash
uv run --with-requirements requirements.txt --python 3.13 main.py
```
4. You should find an ePub file in the same directory as `main.py` with the same name as the input file (except with the `.epub` file extension).
5. Feel free to play around with `prompt.txt`.