This repository provides tools to convert EPUB files into Markdown format and then summarize them using LLMs.
- Convert EPUB to Markdown: Extracts text from an EPUB file and converts it to Markdown format.
- List Chapters in Markdown: Lists all chapters from the Markdown file.
- Summarize Markdown: Summarizes the content of a Markdown file, breaking it down into chapters, and generates concise summaries using GPT-based models.
Install the required Python packages using pip
:
pip install -r requirements.txt
Create an .env file in the root of the project directory with your OpenAI API key and model:
OPENAI_API_KEY=your_openai_api_key_here
MODEL=gpt-4o-mini
Use the convert.py
script to convert an EPUB file to Markdown format:
python convert.py /path/to/your.epub
Use the markdown.py
script to list all chapters in the Markdown file:
python markdown.py --chapters /path/to/your_markdown.md
You can summarize all chapters interactively using the following command:
python markdown.py --summarize /path/to/your_markdown.md
The script will ask for confirmation before summarizing each chapter.
To summarize a specific chapter, use the --chapter
flag:
python markdown.py --summarize /path/to/your_markdown.md --chapter 1
You can customize the prompt used for summarization by editing the prompt.txt
file.