ojasm commited on
Commit
8192189
·
1 Parent(s): 702ce5d
Files changed (2) hide show
  1. handler.py +16 -0
  2. requirements.txt +0 -0
handler.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any
2
+ import pytesseract
3
+ import urllib.request
4
+ from PIL import Image
5
+ pytesseract.pytesseract.tesseract_cmd = r'E:\tesseract ocr\tesseract.exe'
6
+ class EndpointHandler():
7
+ def __init__(self):
8
+ pass
9
+
10
+ def __call__(self, imageUrl: str) -> str:
11
+ urllib.request.urlretrieve(imageUrl, "image.jpg")
12
+ img = Image.open("image.jpg")
13
+ text = pytesseract.image_to_string(img)
14
+ print(text)
15
+
16
+ return text
requirements.txt ADDED
Binary file (110 Bytes). View file