Trying PyMuPDF
Browse files- app.py +2 -2
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -11,7 +11,7 @@ from aimakerspace.openai_utils.embedding import EmbeddingModel
|
|
| 11 |
from aimakerspace.vectordatabase import VectorDatabase
|
| 12 |
from aimakerspace.openai_utils.chatmodel import ChatOpenAI
|
| 13 |
import chainlit as cl
|
| 14 |
-
import
|
| 15 |
|
| 16 |
system_template = """\
|
| 17 |
Use the following context to answer a users question. If you cannot find the answer in the context, say you don't know the answer."""
|
|
@@ -73,7 +73,7 @@ def process_pdf_file(file: AskFileResponse):
|
|
| 73 |
with open(temp_file_path, "wb") as f:
|
| 74 |
f.write(file.content)
|
| 75 |
|
| 76 |
-
doc =
|
| 77 |
texts = []
|
| 78 |
for page in doc:
|
| 79 |
texts.append(page.get_text())
|
|
|
|
| 11 |
from aimakerspace.vectordatabase import VectorDatabase
|
| 12 |
from aimakerspace.openai_utils.chatmodel import ChatOpenAI
|
| 13 |
import chainlit as cl
|
| 14 |
+
import pymupdf
|
| 15 |
|
| 16 |
system_template = """\
|
| 17 |
Use the following context to answer a users question. If you cannot find the answer in the context, say you don't know the answer."""
|
|
|
|
| 73 |
with open(temp_file_path, "wb") as f:
|
| 74 |
f.write(file.content)
|
| 75 |
|
| 76 |
+
doc = pymupdf.open(temp_file_path)
|
| 77 |
texts = []
|
| 78 |
for page in doc:
|
| 79 |
texts.append(page.get_text())
|
requirements.txt
CHANGED
|
@@ -1,3 +1,4 @@
|
|
| 1 |
numpy
|
| 2 |
chainlit==0.7.700
|
| 3 |
-
openai
|
|
|
|
|
|
| 1 |
numpy
|
| 2 |
chainlit==0.7.700
|
| 3 |
+
openai
|
| 4 |
+
PyMuPDF
|