Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/gcv2hocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,20 @@ def __init__(self,
baseline="0 -5",
page_height=None,
page_width=None,
content=[],
content=None,
box=None,
title=''):
if content==None:
self.content = []
else:
self.content = content
self.title = title
self.htmlid = htmlid
self.baseline = baseline
self.page_height = page_height
self.page_width = page_width
self.lang = lang
self.ocr_class = ocr_class
self.content = content
self.x0 = box[0]['x']
self.y0 = box[0]['y']
self.x1 = box[2]['x']
Expand Down Expand Up @@ -158,7 +161,7 @@ def fromResponse(resp, baseline_tolerance=2, **kwargs):
help="Image height. Automatically detected unless specified")
args = parser.parse_args()

instream = sys.stdin if args.gcv_file is '-' else open(args.gcv_file, 'r')
instream = sys.stdin if args.gcv_file is '-' else open(args.gcv_file, 'r', encoding='utf-8')
resp = json.load(instream)
if hasattr(resp, 'responses'): resp = ['responses'][0]

Expand Down