fix multi apps
This commit is contained in:
@@ -200,14 +200,13 @@ def compare_docx_images(docx_file1, docx_file2):
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
import pytesseract
|
import easyocr
|
||||||
|
|
||||||
|
|
||||||
def compare_image_text(image_path, rule):
|
def compare_image_text(image_path, rule):
|
||||||
img = Image.open(image_path)
|
reader = easyocr.Reader(['en'])
|
||||||
img_text = pytesseract.image_to_string(img)
|
result = reader.readtext(image_path)
|
||||||
|
extracted_text = ' '.join([entry[1] for entry in result])
|
||||||
if rule['type'] == 'text':
|
if rule['type'] == 'text':
|
||||||
return 1 if rule['text'] in img_text else 0
|
return 1 if rule['text'] in extracted_text else 0
|
||||||
else:
|
else:
|
||||||
raise ValueError("Unsupported rule type")
|
raise ValueError("Unsupported rule type")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user