Git Product home page Git Product logo

gpt-chatwithpdf's Introduction

GPT-chatwithpdf

This interactive script uses OpenAI's GPT-3 API to answer questions about a PDF document. It breaks the PDF document into chunks of text and uses GPT-3 to generate answers to user questions.

Requirements

  • Python 3
  • OpenAI API key (sign up at openai.com)
  • PyPDF2
  • requests
  • transformers
  • python-dotenv

Installation

  1. Clone the repository or download the ZIP file and extract its contents to a directory of your choice.

  2. Install the required dependencies by running pip3 install -r requirements.txt in the project directory.

  3. Sign up for an OpenAI API key at openai.com and create a new file named .env in the project directory.

  4. Add your OpenAI API key to the .env file as shown below:

    API_KEY=your_api_key_here
    

Usage

Running the script

Run the script by using the command python3 chat.py <URL> in the project directory. Replace <URL> with the URL of the PDF document you want to analyze.

Asking questions

Once the script is running, you can ask questions about the PDF document. Type a question and press Enter. The script will use GPT-3 to generate an answer to your question based on the PDF document.

Providing feedback

After the script generates an answer, you can provide feedback by using one of the following options:

  • Press the Spacebar to bypass the feedback prompt.
  • Press the Up arrow key (^) to indicate that the answer was correct.
  • Press the Down arrow key (v) to indicate that the answer was incorrect.

If you indicate that the answer was incorrect, the script will prompt you to provide the correct information.

Quitting the script

To quit the script, type quit and press Enter.

Supported Platforms

This script should run on any platform that supports Python 3 and the required dependencies, including Windows, Mac, and Linux.

Note: This script was written with the assistance of ChatGPT, a language model trained by OpenAI.

gpt-chatwithpdf's People

Contributors

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