PdfReaderChatGpt is a web application that leverages the power of OpenAI's GPT and Langchain's tools to provide users with an intuitive PDF reading and querying experience. Users can upload a PDF document, input a query, and receive relevant responses extracted from the document using advanced natural language processing techniques.
- Upload PDF files for processing
- Perform similarity searches on the PDF content
- Retrieve and display responses based on the user's query
- Uses OpenAI's GPT for generating responses
- Python
- Streamlit
- OpenAI's GPT (via OpenAI API)
- Langchain
- Chroma for vector storage
- PyPDFLoader for PDF processing
- Python 3.8 or higher
- OpenAI API key
-
Clone the repository:
git clone https://github.com/yourusername/PdfReaderChatGpt.git cd PdfReaderChatGpt
-
Install the required packages:
pip install -r requirements.txt
-
Set up your OpenAI API key:
- Create a file named
api_key.py
in the root directory of the project. - Add your OpenAI API key to this file:
api = "your_openai_api_key_here"
- Ensure the
api_key.py
file is imported and the key is set in your environment.
- Create a file named
-
Run the Streamlit application:
streamlit run app.py
-
Open your web browser and navigate to the local Streamlit server (usually http://localhost:8501).
-
Upload a PDF document using the file uploader interface.
-
Enter a query in the text input field.
-
View the response generated by the application based on the content of the uploaded PDF.
-
pdf_loader(pathname):
- Loads and splits the PDF document into pages.
- Uses Chroma to create a vector store from the document pages.
-
similarity_search(query, path):
- Uses the
pdf_loader
function to load the PDF. - Performs a similarity search on the document content based on the user's query.
- Uses the ChatGPT model to generate a response.
- Uses the
-
main():
- Streamlit application layout.
- Handles file uploading, query input, and displaying responses.
-
loader_interface():
- Manages the file upload process in Streamlit.
- Saves the uploaded PDF file to a specified directory.
Pull requests are welcome! For significant changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License. See the LICENSE file for details.
- OpenAI for providing the powerful GPT model.
- Langchain for the amazing tools and libraries.
- Streamlit for the easy-to-use web application framework.
For any questions or suggestions, feel free to contact Sudha Jaswanth.