GithubHelp home page GithubHelp logo

karin478 / chat_with_pdf Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 11.77 MB

chat with pdf file, ask question base on the document content

License: MIT License

Python 41.45% JavaScript 16.61% CSS 29.78% HTML 12.16%

chat_with_pdf's Introduction

PDF Question Answering Tool

##Description This is a PDF Question-Answering tool developed using Flask, Langchain, and OpenAI embedding. In light of the significant price decrease of OpenAI embeddings, we opted to use them over the local or server embeddings that we had considered earlier. After several trials, we discovered a few issues with these alternatives:

About Embedding

The embedding vector files were extremely large, occupying a significant amount of space. The speed of creating the embeddings was less than ideal. Especially when calculations were done using small-scale server-side CPUs, the process was time-consuming. Therefore, we decided to use OpenAI's embeddings for vector matching.

The operation of the program is quite simple. Users upload a PDF file which is divided into different chunks. When a user poses a question, the system computes the match between the question and the text in each chunk. The best-matching chunk is then sent along with the user's question to the Language Model (LLM), which responds based on the provided context. To make it easier for users to find the original text corresponding to their questions, we've also added a citation feature in the answer section.

Installation Instructions

  1. Set up a virtual environment using pip and install the dependencies listed in the requirements.txt file.

  2. Start the Flask server and navigate to /upload to upload the PDF file for which you have questions. The system will automatically redirect you to the /chat page where you can start conversing with the PDF document.

  3. Set up your .env file with openai api key

Each time question will cost about 0.02$ (test base on a 80 page pdf)

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.