Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
from langchain.document_loaders import
|
4 |
from langchain.embeddings import OpenAIEmbeddings # for creating embeddings
|
5 |
from langchain.vectorstores import Chroma # for the vectorization part
|
6 |
from langchain.chains import ChatVectorDBChain # for chatting with the pdf
|
@@ -10,7 +10,7 @@ from langchain.llms import OpenAI # the LLM model we'll use (CHatGPT)
|
|
10 |
class Chat:
|
11 |
def __init__(self, pdf, api_input):
|
12 |
self.api = api_input
|
13 |
-
loader =
|
14 |
pages = loader.load_and_split()
|
15 |
|
16 |
embeddings = OpenAIEmbeddings(openai_api_key=self.api)
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
from langchain.document_loaders import PyMuPDFLoader # for loading the pdf
|
4 |
from langchain.embeddings import OpenAIEmbeddings # for creating embeddings
|
5 |
from langchain.vectorstores import Chroma # for the vectorization part
|
6 |
from langchain.chains import ChatVectorDBChain # for chatting with the pdf
|
|
|
10 |
class Chat:
|
11 |
def __init__(self, pdf, api_input):
|
12 |
self.api = api_input
|
13 |
+
loader = PyMuPDFLoader(pdf)
|
14 |
pages = loader.load_and_split()
|
15 |
|
16 |
embeddings = OpenAIEmbeddings(openai_api_key=self.api)
|