Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,10 +6,12 @@ import pytesseract
|
|
| 6 |
from docx import Document
|
| 7 |
import tempfile
|
| 8 |
|
| 9 |
-
# Function to convert PDF to image
|
| 10 |
def pdf_to_image(pdf_path):
|
| 11 |
try:
|
| 12 |
-
|
|
|
|
|
|
|
| 13 |
return images
|
| 14 |
except Exception as e:
|
| 15 |
st.error(f"Error during PDF to image conversion: {str(e)}")
|
|
|
|
| 6 |
from docx import Document
|
| 7 |
import tempfile
|
| 8 |
|
| 9 |
+
# Function to convert PDF to image with poppler_path configuration
|
| 10 |
def pdf_to_image(pdf_path):
|
| 11 |
try:
|
| 12 |
+
# Ensure that Poppler tools are correctly set up
|
| 13 |
+
poppler_path = r"C:\Program Files\poppler-24.08.0\Library\bin" # Update this with your actual poppler path
|
| 14 |
+
images = convert_from_path(pdf_path, 500, poppler_path=poppler_path)
|
| 15 |
return images
|
| 16 |
except Exception as e:
|
| 17 |
st.error(f"Error during PDF to image conversion: {str(e)}")
|