Jatin Mehra commited on
Commit
3d7ad51
·
1 Parent(s): f8b71ad

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +123 -0
README.md ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # PDF Insight Pro
3
+
4
+ ## Overview
5
+
6
+ **PDF Insight Pro** is a Streamlit-based web application that allows users to upload PDF documents and interact with them using AI-driven insights. The application processes PDFs to extract text and uses a language model to answer user queries about the content of the documents. Users can adjust model parameters, manage their uploaded documents, and interact with the AI to gain insights from the PDFs.
7
+
8
+ ## Features
9
+
10
+ - **PDF Uploading**: Users can upload multiple PDF files, which are processed and stored as context for generating responses.
11
+ - **AI-Powered Chat**: The app provides an AI-driven assistant that can answer user queries based on the uploaded PDF content.
12
+ - **Model Customization**: Users can tweak model parameters such as temperature, token limit, and model choice to control the response generation.
13
+ - **Document Management**: Uploaded documents can be reviewed, managed, and removed from the context as needed.
14
+ - **Interactive UI**: The application has an intuitive and responsive UI with custom styling for an enhanced user experience.
15
+ - **Error Handling**: The app includes error handling for PDF extraction and model interactions.
16
+
17
+
18
+ ## Requirements
19
+
20
+ ### Python Packages:
21
+ - streamlit==1.31.1 # For APP UI and Deployment
22
+ - streamlit-chat==0.1.1 # For CHAT Feature
23
+ - PyPDF2==3.0.1 # For Processing and extract text from PDFs
24
+ - groq==0.9.0 # For interacting with language model using API
25
+
26
+ ### Environment Variables:
27
+
28
+ - `GROQ_API_KEY`: An API key from the Groq service is required for interacting with the language model. This should be stored as a secret in `st.secrets`.
29
+
30
+ ## How to Run the App
31
+
32
+ 1. Clone this repository:
33
+
34
+ `git clone https://github.com/your-repo/pdf-insight-pro.git`
35
+
36
+ 2. Navigate into the project directory:
37
+
38
+ `cd pdf-insight-pro`
39
+
40
+ 3. Install the required dependencies:
41
+
42
+ `pip install -r requirements.txt`
43
+
44
+ 4. Add your `GROQ_API_KEY` to the Streamlit secrets by creating a `secrets.toml` file in the `.streamlit` directory:
45
+
46
+ `mkdir -p .streamlit
47
+ echo "[groq]\nGROQ_API_KEY = 'your-api-key-here'" > .streamlit/secrets.toml`
48
+
49
+ 5. Run the application:
50
+
51
+ `streamlit run app.py`
52
+
53
+ 6. Open your browser and go to `http://localhost:8501` to interact with the application.
54
+
55
+
56
+ ## Application Structure
57
+
58
+ - **app.py**: This is the main file that sets up the Streamlit application. It handles the UI, user inputs, and interactions with the model.
59
+ - **preprocessing.py**: This file contains the `Model` class that manages document processing, context generation, and interaction with the Groq API for generating responses.
60
+
61
+ ### Key Components
62
+
63
+ 1. **PDF Upload and Processing**:
64
+
65
+ - Users can upload PDF files, and the content of these files is extracted and added to the context.
66
+ - The extracted content is stored in the session state for generating responses to user queries.
67
+ 2. **AI Interaction**:
68
+
69
+ - The AI assistant uses the `Groq` API to generate answers based on the uploaded PDF content and user queries.
70
+ - Users can customize the response generation by adjusting parameters like model type, token length, and sampling temperature.
71
+ 3. **Document Management**:
72
+
73
+ - Users can view and remove documents from the session state to adjust the context used for generating responses.
74
+
75
+ ## Usage
76
+
77
+ ### Upload PDF Documents
78
+
79
+ - In the "Upload Your PDF Documents" section, users can upload one or more PDF files. The app will process and extract text from these PDFs, storing them for later queries.
80
+
81
+ ### Ask Questions
82
+
83
+ - Users can type questions about the content of the uploaded PDFs in the provided input field. The AI assistant will generate responses based on the content of the uploaded files.
84
+
85
+ ### Customize AI Settings
86
+
87
+ - The "Customize AI Settings" section allows users to tweak the response generation process by adjusting parameters like temperature, max tokens, and model selection.
88
+
89
+ ### Manage Documents
90
+
91
+ - Users can manage uploaded documents by viewing their content or removing them from the context. This feature helps control what information is used to generate responses.
92
+
93
+ ## Offline Version (Local LLM)
94
+ [Local AI RAG APP](https://github.com/Jatin-Mehra119/local-rag-with-ollama)
95
+
96
+ In addition to the standard version, **PDF Insight Pro** also offers an **offline mode** that allows users to process PDF documents and interact with a local LLM (Large Language Model) without requiring an internet connection. This version is ideal for users who need to ensure privacy, security, or have limited access to the internet.
97
+
98
+ ### Key Features of the Offline Version:
99
+
100
+ - **Local LLM**: The application utilizes a locally hosted language model, eliminating the need for cloud-based API calls.
101
+ - **Data Privacy**: Since all operations, including document processing and AI interactions, occur locally on the user's machine, this version is highly secure and private.
102
+ - **No Internet Required**: Once the offline version is set up, you can upload, analyze, and query PDF documents entirely offline.
103
+
104
+
105
+ ### Drawbacks of Offline Version
106
+
107
+ While the offline version offers privacy and works without an internet connection, it comes with some limitations:
108
+
109
+ - **Performance**: Running large language models locally can be significantly slower compared to cloud-based APIs. Inference times may increase, especially on machines without high-end CPUs or GPUs.
110
+
111
+ - **Computationally Expensive**: Local LLMs require substantial computational resources, including high RAM usage and, ideally, a dedicated GPU. Running models like GPT-2, llama, or other advanced LLMs on standard consumer hardware may result in lag or crashes.
112
+
113
+ - **Model Size**: Large language models can take up significant storage space (often several GBs), which may not be ideal for users with limited disk space.
114
+
115
+ - **Limited Model Options**: The offline version restricts users to the pre-downloaded or supported models, which may not perform as well as newer or more powerful cloud-based models.
116
+ - **Recommended GPU**: - NVIDIA GeForce RTX 3090 Ti (For Smaller Models)
117
+
118
+
119
+ ## Future Improvements
120
+
121
+ - Add support for more document formats (e.g., DOCX, TXT).
122
+ - Implement user authentication to save and retrieve uploaded files and chats.
123
+ - Enhance caching and improve response time for repeated queries.