Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ocr_manager.py 添加Umiocr识别中文 #250

Open
Zhang3647 opened this issue Nov 11, 2024 · 0 comments
Open

ocr_manager.py 添加Umiocr识别中文 #250

Zhang3647 opened this issue Nov 11, 2024 · 0 comments

Comments

@Zhang3647
Copy link

Integrated Umi OCR HTTP interface for Chinese recognition

` import base64
import requests
with open(img_input, "rb") as image_file:
img_data = image_file.read()

# 对图像字节数据进行 base64 编码
img_base64 = base64.b64encode(img_data).decode('utf-8')

url = 'http://127.0.0.1:1224/api/ocr'

json1 = {
"base64": img_base64,
"options": {
    "ocr.language": "models/config_chinese.txt",
    "ocr.cls": True,
    "ocr.limit_side_len": 4320,
    "tbpu.parser": "multi_none",
    "data.format": "text"
    }
}
data = requests.post(url,json=json1)
text = data.json()['data']
text = str(text.encode("utf-8").decode("utf-8"))`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant