File size: 453 Bytes
8192189
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from typing import Any
import pytesseract
import urllib.request
from PIL import Image
pytesseract.pytesseract.tesseract_cmd = r'E:\tesseract ocr\tesseract.exe'
class EndpointHandler():
    def __init__(self):
        pass

    def __call__(self, imageUrl: str) -> str:
        urllib.request.urlretrieve(imageUrl, "image.jpg")
        img = Image.open("image.jpg")
        text = pytesseract.image_to_string(img)
        print(text)

        return text