Fix Lens issue
This commit is contained in:
14
owocr/ocr.py
14
owocr/ocr.py
@@ -288,12 +288,14 @@ class GoogleLens:
|
|||||||
response_dict = response_proto.to_dict(betterproto.Casing.SNAKE)
|
response_dict = response_proto.to_dict(betterproto.Casing.SNAKE)
|
||||||
|
|
||||||
res = ''
|
res = ''
|
||||||
text = response_dict['objects_response']['text']['text_layout']['paragraphs']
|
text = response_dict['objects_response']['text']
|
||||||
for paragraph in text:
|
if 'text_layout' in text:
|
||||||
for line in paragraph['lines']:
|
paragraphs = text['text_layout']['paragraphs']
|
||||||
for word in line['words']:
|
for paragraph in paragraphs:
|
||||||
res += word['plain_text'] + word['text_separator']
|
for line in paragraph['lines']:
|
||||||
res += '\n'
|
for word in line['words']:
|
||||||
|
res += word['plain_text'] + word['text_separator']
|
||||||
|
res += '\n'
|
||||||
|
|
||||||
x = (True, res)
|
x = (True, res)
|
||||||
return x
|
return x
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "owocr"
|
name = "owocr"
|
||||||
version = "1.13.1"
|
version = "1.13.2"
|
||||||
description = "Japanese OCR"
|
description = "Japanese OCR"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
|
|||||||
Reference in New Issue
Block a user