Skip to content

Required payload to get the best quality results with Python #8

@EXELANCE-LLC

Description

@EXELANCE-LLC

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions