This commit is contained in:
suke 2025-02-03 16:13:43 +09:00 committed by GitHub
commit 6964e34a96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1092,6 +1092,20 @@ class ImageConverter(MediaConverter):
).strip()
+ "\n"
)
# add ocr only when MLM is not available
if mlm_client is None or mlm_model is None:
try:
import easyocr
reader = easyocr.Reader(['ch_sim','en']) # support chinese and english
ocr_result = reader.readtext(local_path)
if ocr_result:
md_content += "\n"
for detection in ocr_result:
text = detection[1] # extract text
md_content += f"- {text}\n"
except ImportError:
# easyocr not installed
pass
return DocumentConverterResult(
title=None,