Created
July 23, 2023 16:27
-
-
Save Gpzim98/a88f78e8d6fe8a71d769ff974a0b80d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import constants | |
from langchain.vectorstores import FAISS | |
from langchain.embeddings.openai import OpenAIEmbeddings | |
from langchain.document_loaders import PyPDFLoader | |
from langchain.indexes import VectorstoreIndexCreator | |
os.environ['OPENAI_API_KEY'] = constants.APIKEY | |
loader = PyPDFLoader("databackup/mypdf.pdf") | |
index = VectorstoreIndexCreator().from_loaders([loader]) | |
query = input(">> ") | |
resp = index.query(query) | |
print("------------------------------------") | |
print(resp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
gptpdf.py