Skip to content

PogusTheWhisper/RIWUS---Read-It-With-Ur-Self

Repository files navigation

RIWUS - Read It With Ur(your) Self

An intelligent PDF reader application that combines document viewing with AI-powered summarization and interactive chat capabilities. RIWUS automatically tracks your reading time and generates summaries of pages you spend time on, then allows you to ask questions about the content.

Features

PDF Viewing

  • Clean, intuitive PDF viewer interface
  • Page navigation with Previous/Next buttons
  • Page counter display
  • Asynchronous page loading for smooth performance

Reading Time Tracking

  • Automatically tracks time spent on each page
  • Saves reading session data persistently
  • Triggers AI summarization for pages viewed longer than 5 seconds

AI-Powered Summarization

  • Integrates with Typhoon AI for intelligent text summarization
  • Automatically extracts and summarizes text from PDF pages
  • Generates concise summaries in Thai language
  • Saves summaries to text files for future reference

Interactive Chat

  • Built-in chat interface for asking questions about the PDF content
  • AI assistant answers questions based on the summarized content
  • Real-time streaming responses
  • Chat history with clear conversation formatting

User Interface

  • Split-screen layout with PDF viewer and chat panel
  • Logo integration for branding
  • Responsive design with proper scaling
  • Clean, modern interface using Tkinter

Installation

Prerequisites

  • Python 3.12+
  • Poetry (recommended) or pip

Using Poetry

# Clone the repository
git clone <repository-url>
cd riwus

# Install dependencies
poetry install

# Run the application
poetry run python main.py

Using pip

# Install dependencies
pip install -r requirements.txt

# Run the application
python main.py

Dependencies

Core Libraries

  • PyMuPDF (fitz): PDF processing and text extraction
  • tkinter: GUI framework
  • Pillow (PIL): Image processing for PDF rendering
  • OpenAI: AI integration for Typhoon API

Additional Libraries

  • threading: Asynchronous operations
  • json: Data persistence
  • time: Reading time tracking

Configuration

AI Setup

  1. Obtain a Typhoon AI API token
  2. Replace <Typhoon token> in main.py with your actual API key:
self.client = OpenAI(
    api_key='your-typhoon-token-here',
    base_url="https://api.opentyphoon.ai/v1",
)

Logo Setup

  • Place your logo image as logo - round coners.png in the project root
  • The application will automatically load and display it

Usage

  1. Launch the application:

    python main.py
  2. Open a PDF:

    • Click "Open PDF" button
    • Select your PDF file from the file dialog
  3. Navigate the document:

    • Use Previous/Next buttons to navigate pages
    • Page information is displayed at the bottom
  4. Automatic summarization:

    • Spend more than 5 seconds on a page to trigger AI summarization
    • Summaries are saved to {filename}_page_texts.txt
  5. Ask questions:

    • Type questions in the chat input field
    • Press Enter or click Send
    • The AI will answer based on the summarized content

File Structure

riwus/
├── main.py                 # Main application file
├── main.ipynb             # Jupyter notebook version
├── pyproject.toml         # Poetry configuration
├── requirements.txt       # Pip dependencies
├── logo - round coners.png # Application logo
├── Book/                  # Sample documents
└── generated files:
    ├── pages.json         # Processed pages tracking
    ├── {pdf}_page_texts.txt # AI summaries
    └── {pdf}_page_time.json # Reading time data

How It Works

Reading Time Tracking

  • Tracks time spent on each page automatically
  • Saves data persistently between sessions
  • Uses time thresholds to determine engagement level

AI Integration

  • Extracts text from PDF pages using PyMuPDF
  • Sends text to Typhoon AI for summarization
  • Processes streaming responses for real-time display
  • Maintains conversation context for Q&A

Data Persistence

  • pages.json: Tracks which pages have been processed
  • {filename}_page_texts.txt: Stores AI-generated summaries
  • {filename}_page_time.json: Saves reading time statistics

Customization

AI Model Configuration

You can switch between different Typhoon models by modifying the model parameter:

model="typhoon-instruct"  # Current default
# model="typhoon-v1.5x-70b-instruct"  # Alternative model

Time Threshold

Adjust the time threshold for triggering summarization:

if page_number not in pages and self.page_time.get(page_number, 0) > 5:  # 5 seconds

UI Customization

  • Modify window dimensions and layout in the __init__ method
  • Customize colors, fonts, and styling through tkinter configuration
  • Replace logo by updating the logo file path

Troubleshooting

Common Issues

  1. Missing PIL module: Install Pillow with pip install Pillow
  2. API key errors: Ensure your Typhoon API key is valid and properly configured
  3. PDF loading issues: Check file permissions and PDF format compatibility
  4. Logo not displaying: Verify logo file path and format

Performance Tips

  • Large PDFs may take longer to process
  • AI summarization depends on network connectivity
  • Close unused applications to improve rendering performance

License

This project is licensed under the terms specified in the LICENSE file.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

Support

For issues and questions:

  • Check the troubleshooting section
  • Review the code documentation
  • Create an issue in the repository

RIWUS - Making PDF reading smarter with AI-powered insights and interactive learning.

About

LLM that understand only things that you understand.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published