Git Product home page Git Product logo

chineseocr_lite's Introduction

chineseocr_lite 的 onnx 推理, 部署简单

原始项目分支(torch推理,ncnn推理等):master

环境

  • python3.6

  • linux/macos/windows

web服务启动

cd chineseocr_lite## 进入chineseocr目录
source .venv/bin/activate
python backend/main.py 

以下为从Python代码翻译为各种语言的Demo,仅供参考:

在线体验(lite版本<模型还在训练中>,支持竖排,空格识别,文字行方向旋转): http://ocr.timeline229.com:8089/

识别结果展示

参考

  1. 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()

QQ群

994929053

chineseocr_lite's People

Contributors

kangzai228 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.