Spaces:
Sleeping
Sleeping
File size: 453 Bytes
58098b9 6eb7212 58098b9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import easyocr
import numpy as np
# Load the EasyOCR reader
reader = easyocr.Reader(['en'], gpu=False)
def extract_text(image):
# Convert the image to an array for OCR
image_np = np.array(image)
# Perform OCR on the image
result = reader.readtext(image_np)
# Extract text from the OCR result
extracted_text = []
for (bbox, text, prob) in result:
extracted_text.append(text)
return extracted_text
|