A cross platform OCR Library based on OnnxRuntime.
Project description
rapidocr-web
1. Install package by pypi.
$ pip install rapidocr-web
2. Run by command line.
- Usage:
$ rapidocr_web -h usage: rapidocr_web [-h] [-ip IP] [-p PORT] [-api] optional arguments: -h, --help show this help message and exit -ip IP, --ip IP IP Address -p PORT, --port PORT IP port -api, --is_api Whether to use the api format.
- Example:
# Web mode $ rapidocr_web -ip "0.0.0.0" -p 9003 # API mode $ rapidocr_web -ip "0.0.0.0" -p 9003 -api
3. Use.
- Web mode: Open
http://localhost:9003/
to view, enjoy it. - API mode:
import ast import base64 import json import requests def get_json_format(img_path): with open(img_path, 'rb') as f: img_byte = base64.b64encode(f.read()) img_json = json.dumps({'file': img_byte.decode('ascii')}) return img_json if __name__ == '__main__': url = 'http://localhost:9003/ocr' header = {'Content-Type': 'application/json; charset=UTF-8'} img_path = '1.jpg' img_json = get_json_format(img_path) response = requests.post(url, data=img_json, headers=header) if response.status_code == 200: rec_res = ast.literal_eval(response.text) print(rec_res) else: print(response.status_code)
See details for RapidOCR.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for rapidocr_web-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a50fc0758ae6d072e3ccf0758958c0bb7767903061f8e8e44584635e169443a1 |
|
MD5 | 417c0ffef61d43cb5f3dcbd269307ded |
|
BLAKE2b-256 | efe46961e96c237d43bb17faf5f7d47a8e6b981737139967a83dd16427d16ab3 |