Update utils.py
Browse files
utils.py
CHANGED
|
@@ -4,7 +4,6 @@ import pdf2image
|
|
| 4 |
import io
|
| 5 |
import base64
|
| 6 |
from dotenv import load_dotenv
|
| 7 |
-
from pathlib import Path
|
| 8 |
|
| 9 |
load_dotenv()
|
| 10 |
|
|
@@ -19,10 +18,10 @@ def get_gemini_response(prompt, pdf_content, input):
|
|
| 19 |
def input_pdf_setup(uploaded_file):
|
| 20 |
if uploaded_file is not None:
|
| 21 |
## Convert the PDF to image
|
| 22 |
-
|
| 23 |
images=pdf2image.convert_from_bytes(
|
| 24 |
uploaded_file.read(),
|
| 25 |
-
poppler_path=
|
| 26 |
)
|
| 27 |
# first_page=images[0]
|
| 28 |
pdf_parts = []
|
|
|
|
| 4 |
import io
|
| 5 |
import base64
|
| 6 |
from dotenv import load_dotenv
|
|
|
|
| 7 |
|
| 8 |
load_dotenv()
|
| 9 |
|
|
|
|
| 18 |
def input_pdf_setup(uploaded_file):
|
| 19 |
if uploaded_file is not None:
|
| 20 |
## Convert the PDF to image
|
| 21 |
+
path = os.path.join('poppler-23.11.0', 'Library', 'bin')
|
| 22 |
images=pdf2image.convert_from_bytes(
|
| 23 |
uploaded_file.read(),
|
| 24 |
+
poppler_path= path
|
| 25 |
)
|
| 26 |
# first_page=images[0]
|
| 27 |
pdf_parts = []
|