Skip to content

Quick illustration of how one can easily read books together with LLMs. It's great and I highly recommend it.

Notifications You must be signed in to change notification settings

MohanElapolu/reader3

 
 

Repository files navigation

reader3

A lightweight, self-hosted EPUB reader with a built-in AI chat window. Read any EPUB one chapter at a time, and ask a local LLM (Ollama) or the OpenAI API questions about the current chapterโ€”no copy/paste required.

Inspired by Karpathyโ€™s idea of โ€œreading books with LLMsโ€ can be found in this repository "karpath/reader3". this project is intentionally simple, hackable, and easy to modify with the help of any LLM.

Final UI

Below is how the reader appears with integrated chat window..

Response with questions in the chapter...

Response with questions not in the chapter..


Features

  • ๐Ÿ“– Clean, chapter-based EPUB reader
  • ๐Ÿ’ฌ Integrated chat window on the right
  • ๐Ÿค– Supports local LLMs (Ollama) or OpenAI GPT models
  • ๐Ÿ“˜ Automatically sends the current chapter text as context
  • ๐Ÿ”’ LLM is restricted to chapter content only
  • ๐Ÿงน .env support with python-dotenv
  • ๐Ÿ—‚๏ธ Simple library system (*_data folders)

Usage

1. Install dependencies

Install all the required dependencies of the file

pip install -r requirements.txt

2. Process an EPUB

Download an EPUB (e.g., Dracula from Project Gutenberg) and process it. Place this file in the project folder

python reader3.py dracula.epub

This creates a folder:

dracula_data/
  โ”œโ”€โ”€ book.pkl
  โ””โ”€โ”€ images/

Each *_data folder becomes a book in your library.

3. Run the server

python server.py

visit: http://localhost:8123/ You'll see local libary and can open any book

4. Enable OpenAI

Create a .env file in your project folder with below line defining your open ai key.

OPENAI_API_KEY=your_key_here

If omitted, only local LLM model is available

About

Quick illustration of how one can easily read books together with LLMs. It's great and I highly recommend it.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 64.2%
  • HTML 35.8%