You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
667 B

This file contains ambiguous Unicode characters!

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)