1 Star 0 Fork 217

网络虫 / python-learn

forked from mktime / python-learn 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ocr_words.py 800 Bytes
一键复制 编辑 原始数据 按行查看 历史
mktime 提交于 2022-10-21 11:41 . 自查
from aip import AipOcr
import os
""" 读取文件 """
def get_file_content(filePath):
with open(filePath, "rb") as fp:
return fp.read()
""" 你的 APPID AK SK """
APP_ID = os.environ['APP_ID']
API_KEY = os.environ['API_KEY']
SECRET_KEY = os.environ['SECRET_KEY']
print(APP_ID)
print(API_KEY)
print(SECRET_KEY)
client = AipOcr(APP_ID, API_KEY, SECRET_KEY)
print('client', client)
image = get_file_content('/home/linus/图片/test2.jpg')
# 调用通用文字识别(标准版)
#res_image = client.basicGeneral(image)
#print(res_image)
# 如果有可选参数
options = {}
options["language_type"] = "CHN_ENG"
options["detect_direction"] = "false"
options["detect_language"] = "false"
options["probability"] = "false"
res_image = client.basicGeneral(image, options)
print(res_image)
Python
1
https://gitee.com/wangluochong/python-learn.git
git@gitee.com:wangluochong/python-learn.git
wangluochong
python-learn
python-learn
master

搜索帮助