Language selection for OCR. Fixes #107

This commit is contained in:
2017-05-29 02:25:50 +04:00
parent 3feeb568d8
commit 2618e0ac90
4 changed files with 14 additions and 4 deletions

View File

@@ -15,12 +15,14 @@ class OCRSpaceAPI(object):
self.key = key
self.url = url
def OCR_URL(self, url, overlay=False):
def OCR_URL(self, url, overlay=False, lang=None):
payload = {
'url': url,
'isOverlayRequired': overlay,
'apikey': self.key,
}
if lang != None:
payload.update(language=lang)
r = requests.post(self.url, data=payload)
result = r.json()['ParsedResults'][0]
if result['ErrorMessage']: