The process takes long time and there is no limit to how long it will takes, it just does not ends.
Downloading detection model, please wait. This may take several minutes depending upon your network connection.```
Other libraries required locally hosted files so using EasyOCR was a solution to run the app on streamlit server, worked few times but now it goes on running.
Here is the code implementation:
def process_ocr_pdf(pdf_file):
“”“Main function to process PDF and extract text using OCR.”“”
try:
# Create reader once
reader = easyocr.Reader([‘en’])
# Reset file pointer to beginning
pdf_file.seek(0)
# Extract images
images = extract_images_from_pdf(pdf_file)
if not images:
return None
# Extract text from each image
texts = []
for img in images:
text = extract_text_from_image(reader, img)
if text:
texts.append(text)
return texts if texts else None
except Exception as e:
print(f"Failed to process the file: {e}")
return None
Is there any solution to it ?