Spaces:
Sleeping
Sleeping
File size: 525 Bytes
0c75190 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# ocr_utils.py
import easyocr
import numpy as np
# Initialize the EasyOCR reader for Hindi and English
reader = easyocr.Reader(['hi', 'en'])
def extract_text(image_np):
"""
Extract text from a NumPy array image using EasyOCR.
Parameters:
- image_np: NumPy array representation of the image.
Returns:
- full_text: Extracted text as a single string.
"""
extracted_text = reader.readtext(image_np, detail=0)
full_text = " ".join(extracted_text)
return full_text
|