Git Product home page Git Product logo

pdf_reader's Introduction

PdfReaderChatGpt

Project Overview

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.

Features

  • 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

Technologies Used

  • Python
  • Streamlit
  • OpenAI's GPT (via OpenAI API)
  • Langchain
  • Chroma for vector storage
  • PyPDFLoader for PDF processing

Prerequisites

  • Python 3.8 or higher
  • OpenAI API key

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/PdfReaderChatGpt.git
    cd PdfReaderChatGpt
  2. Install the required packages:

    pip install -r requirements.txt
  3. 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.

Usage

  1. Run the Streamlit application:

    streamlit run app.py
  2. Open your web browser and navigate to the local Streamlit server (usually http://localhost:8501).

  3. Upload a PDF document using the file uploader interface.

  4. Enter a query in the text input field.

  5. View the response generated by the application based on the content of the uploaded PDF.

Code Explanation

Main Functions

  • 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.
  • 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.

Contributing

Pull requests are welcome! For significant changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

  • OpenAI for providing the powerful GPT model.
  • Langchain for the amazing tools and libraries.
  • Streamlit for the easy-to-use web application framework.

Contact

For any questions or suggestions, feel free to contact Sudha Jaswanth.

pdf_reader's People

Contributors

jaswanthsudha avatar prudvi-123 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.