base from:DayBreak-u/chineseocr_lite
原始项目分支(torch推理,ncnn推理等):master
-
python3.6
-
linux/macos/windows
cd chineseocr_lite## 进入chineseocr目录
source .venv/bin/activate
python backend/main.py
在线体验(lite版本<模型还在训练中>,支持竖排,空格识别,文字行方向旋转): http://ocr.timeline229.com:8089/
- TrWebOCR https://github.com/alisen39/TrWebOCR
from pprint import pprint
# Python 使用File上传文件
import requests
def ocr_img():
# url = 'http://www.5uks.net:3000/api/tr-run/'
url = 'http://www.5uks.net:3000/api/zh-ocr/'
img1_file = {
'file': open('img1.png', 'rb')
}
res = requests.post(url=url, data={'compress': 0}, files=img1_file)
pprint(res.json())
# Python 使用Base64
import requests
import base64
def img_to_base64(img_path):
with open(img_path, 'rb')as read:
b64 = base64.b64encode(read.read())
return b64
def ocr_base64():
# url = 'http://www.5uks.net:3000/api/tr-run/'
url = 'http://www.5uks.net:3000/api/zh-ocr/'
img_b64 = img_to_base64('./img1.png')
res = requests.post(url=url, data={'img': img_b64})
pprint(res.json())
if __name__=="__main__":
# ocr_img()
ocr_base64()
994929053