File size: 530 Bytes
6604d8f
 
 
52916f3
 
 
 
 
 
 
 
 
6604d8f
 
 
 
52916f3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from PIL import Image
import pytesseract

# # If you don't have tesseract executable in your PATH, include the following:
# pytesseract.pytesseract.tesseract_cmd = r'C:\TesseractOCR\tesseract'

# # Simple image to string
# def img2string(imgPath):
#     textOfImage = pytesseract.image_to_string(imgPath)
#     return textOfImage

# Changed version of above code for deployment on huggingface spaces 

# Simple image to string
def img2string(imgPath):
    textOfImage = pytesseract.image_to_string(imgPath)
    return textOfImage