• pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
  • pip install paddlehub --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple
  • 服务端

hub serving start -m chinese_ocr_db_crnn_mobile -p 5555

 

  • 客户端

pip install shapely、pyclipper

import requests
import json
import cv2
import base64

def cv2_to_base64(image):
    data = cv2.imencode('.jpg', image)[1]
    return base64.b64encode(data.tostring()).decode('utf8')

# 发送HTTP请求
data = {'images':[cv2_to_base64(cv2.imread("2.jpg"))]}
headers = {"Content-type": "application/json"}
url = "http://gt.g.cn:5555/predict/chinese_ocr_db_crnn_mobile"
print(url)
r = requests.post(url=url, headers=headers, data=json.dumps(data))
print(r)
# 打印预测结果
print(r.json()["results"])

  

相关文章:

  • 2021-12-09
  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2021-07-14
  • 2022-02-07
  • 2021-08-12
  • 2021-06-22
猜你喜欢
  • 2022-01-23
  • 2021-10-16
  • 2022-12-23
  • 2022-02-07
  • 2021-07-07
  • 2023-03-23
  • 2021-12-16
相关资源
相似解决方案