This application allows users to upload documents in various formats (PDF, DOCX, TXT, MD) and receive detailed summaries or answers to specific queries about the content. The application leverages advanced AI models and a local instance of Ollama's LLM for natural language processing tasks.
- Multiple File Format Support: Upload and process PDF, DOCX, TXT, and Markdown files.
- Text Summarization: Automatically summarize the content of the uploaded document.
- Question-Answering: Ask any question related to the document, and the AI provides a precise answer.
- Local LLM with Ollama: Utilize the power of local language models using Ollama for high performance and privacy.
- Python 3.8 or later
- Virtual Environment: It is recommended to use a virtual environment to manage dependencies.
- Ollama: Ensure you have Ollama installed and set up on your local machine. Ollama Installation Guide.
-
Clone the Repository
git clone https://github.com/aslanok/Summarize-Book.git cd Summarize-Book
-
Create a Virtual Environment It's highly recommended to create a virtual environment to manage dependencies:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies All required Python packages are listed in the
requirements.txt
file. Install them using pip:pip install -r requirements.txt
-
Configure Ollama (for Local LLM) Make sure Ollama is properly configured and the required model is downloaded. The application uses the
gemma2:2b
model. You can configure Ollama by following the official Ollama Documentation.
-
Start the Application Run the Streamlit application:
streamlit run app.py
-
Upload a Document
- Navigate to the Streamlit interface in your browser.
- Upload a document (PDF, DOCX, TXT, or MD).
- The document will be processed, and its content will be split into manageable chunks for analysis.
-
Ask a Question or Request a Summary
- Enter your query in the provided text input field. You can ask for a summary or any specific details about the document.
- Click the "Generate Answer" button.
- The application will retrieve relevant sections from the document and generate a concise answer using the local LLM.
- File Processing: The application reads and processes different file formats, converting the content into plain text.
- Text Splitting: The text is split into smaller chunks using the
RecursiveCharacterTextSplitter
to manage large documents efficiently. - Embedding and Indexing: The text chunks are embedded using the
SentenceTransformer
model and stored in aChromaDB
instance. - Question-Answering: The application uses a local LLM (Ollama) combined with a
ChromaDB
-backed retrieval mechanism to answer user queries. - Local LLM Integration: The Ollama model is used to generate accurate and context-aware responses, ensuring privacy and performance by keeping the computation local.
If you encounter any issues or have questions, please create an issue in the GitHub repository.