This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
"""
conda activate rag
# 安装docling
pip install docling
# 安装OCR工具
pip install easyocr
import easyocr
ocr_model_path = "E:/model/ocr/EasyOCR/model"
reader = easyocr.Reader(
# 设置识别图片中语言的模型
lang_list=['ch_sim', 'en'],
# 注意会自动下载模型到路径下,可以不指定模型目录,会自动下载到C盘下
# 包括三个模型
# 文本检测模型:CRAFT -- craft_mlt_25k.pth
# 中文简体模型:ch_sim -- zh_sim_g2.pth
# 英文模型:en -- latin_g2.pth
model_storage_directory=ocr_model_path
)
result = reader.readtext("E:/test/test.png")
print(result)