Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,12 +4,14 @@ from pdf2image import convert_from_bytes
|
|
| 4 |
import google.generativeai as genai
|
| 5 |
import os
|
| 6 |
|
| 7 |
-
|
| 8 |
|
| 9 |
-
# Set
|
| 10 |
-
|
|
|
|
| 11 |
|
| 12 |
def extract_text_from_pdf(uploaded_file):
|
|
|
|
| 13 |
images = convert_from_bytes(uploaded_file.read(), poppler_path=POPPLER_PATH)
|
| 14 |
|
| 15 |
extracted_text = ""
|
|
|
|
| 4 |
import google.generativeai as genai
|
| 5 |
import os
|
| 6 |
|
| 7 |
+
from pdf2image import convert_from_bytes
|
| 8 |
|
| 9 |
+
# Set the correct paths
|
| 10 |
+
pytesseract.pytesseract.tesseract_cmd = "/usr/bin/tesseract"
|
| 11 |
+
POPPLER_PATH = "/usr/bin" # Explicitly define Poppler path
|
| 12 |
|
| 13 |
def extract_text_from_pdf(uploaded_file):
|
| 14 |
+
# Convert PDF to images using the correct Poppler path
|
| 15 |
images = convert_from_bytes(uploaded_file.read(), poppler_path=POPPLER_PATH)
|
| 16 |
|
| 17 |
extracted_text = ""
|