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.
- Clean, intuitive PDF viewer interface
- Page navigation with Previous/Next buttons
- Page counter display
- Asynchronous page loading for smooth performance
- Automatically tracks time spent on each page
- Saves reading session data persistently
- Triggers AI summarization for pages viewed longer than 5 seconds
- 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
- 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
- Split-screen layout with PDF viewer and chat panel
- Logo integration for branding
- Responsive design with proper scaling
- Clean, modern interface using Tkinter
- Python 3.12+
- Poetry (recommended) or pip
# Clone the repository
git clone <repository-url>
cd riwus
# Install dependencies
poetry install
# Run the application
poetry run python main.py# Install dependencies
pip install -r requirements.txt
# Run the application
python main.py- PyMuPDF (fitz): PDF processing and text extraction
- tkinter: GUI framework
- Pillow (PIL): Image processing for PDF rendering
- OpenAI: AI integration for Typhoon API
- threading: Asynchronous operations
- json: Data persistence
- time: Reading time tracking
- Obtain a Typhoon AI API token
- Replace
<Typhoon token>inmain.pywith your actual API key:
self.client = OpenAI(
api_key='your-typhoon-token-here',
base_url="https://api.opentyphoon.ai/v1",
)- Place your logo image as
logo - round coners.pngin the project root - The application will automatically load and display it
-
Launch the application:
python main.py
-
Open a PDF:
- Click "Open PDF" button
- Select your PDF file from the file dialog
-
Navigate the document:
- Use Previous/Next buttons to navigate pages
- Page information is displayed at the bottom
-
Automatic summarization:
- Spend more than 5 seconds on a page to trigger AI summarization
- Summaries are saved to
{filename}_page_texts.txt
-
Ask questions:
- Type questions in the chat input field
- Press Enter or click Send
- The AI will answer based on the summarized content
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
- Tracks time spent on each page automatically
- Saves data persistently between sessions
- Uses time thresholds to determine engagement level
- 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
- pages.json: Tracks which pages have been processed
- {filename}_page_texts.txt: Stores AI-generated summaries
- {filename}_page_time.json: Saves reading time statistics
You can switch between different Typhoon models by modifying the model parameter:
model="typhoon-instruct" # Current default
# model="typhoon-v1.5x-70b-instruct" # Alternative modelAdjust the time threshold for triggering summarization:
if page_number not in pages and self.page_time.get(page_number, 0) > 5: # 5 seconds- 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
- Missing PIL module: Install Pillow with
pip install Pillow - API key errors: Ensure your Typhoon API key is valid and properly configured
- PDF loading issues: Check file permissions and PDF format compatibility
- Logo not displaying: Verify logo file path and format
- Large PDFs may take longer to process
- AI summarization depends on network connectivity
- Close unused applications to improve rendering performance
This project is licensed under the terms specified in the LICENSE file.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
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.