-
Notifications
You must be signed in to change notification settings - Fork 51
Description
import re
import requests
def ocr_space_file(filename, overlay=False, OCREngine=2, api_key='xxxxxxxxxxxxxxxxxxxxxxxx', language='eng', FileType='Auto', IsCreateSearchablePDF=False, isSearchablePdfHideTextLayer=True, detectOrientation=False, isTable=False, scale=True, detectCheckbox=False):
payload = {
'isOverlayRequired': overlay,
'apikey': api_key,
'language': language,
'FileType': FileType,
'IsCreateSearchablePDF': IsCreateSearchablePDF,
'isSearchablePdfHideTextLayer': isSearchablePdfHideTextLayer,
'detectOrientation': detectOrientation,
'detectOrientation': detectOrientation,
'scale': scale,
'OCREngine': OCREngine,
'detectCheckbox': detectCheckbox,
}
with open(filename, 'rb') as f:
response = requests.post('https://api.ocr.space/parse/image',
files={filename: f},
data=payload,
)
return response.json()
#you must write the rest of the code. This is just the code up to the payload part.