A Dockerized REST API service for text recognition using WeChat's OCR engine.
This project wraps the WeChat OCR functionality from the excellent wechat-ocr project into a simple REST API service that can be easily deployed using Docker. It allows you to perform optical character recognition on images by leveraging WeChat's powerful OCR capabilities.
This is an open-source project intended for learning and communication purposes only. Please do not use it for commercial activities. Users are solely responsible for any consequences resulting from improper use of this project.
Copyright Disclaimer: This project is merely a containerization of an existing open-source project. If you believe this repository infringes upon your copyright or intellectual property rights, please contact the repository owner immediately, and the repository will be promptly removed. We respect intellectual property rights and have no intention of infringing on them.
This project would not be possible without the work of swigger and their wechat-ocr project. Their efforts in reverse-engineering and creating a usable interface for WeChat's OCR functionality form the foundation of this service.
# Pull the image
docker pull golangboyme/wxocr
# Run the container
docker run -d -p 5000:5000 --name wechat-ocr-api golangboyme/wxocr
Send a POST request to /ocr
with a JSON payload containing your base64-encoded image:
curl -X POST http://localhost:5000/ocr \
-H "Content-Type: application/json" \
-d '{"image": "BASE64_ENCODED_IMAGE_DATA"}'
{ "errcode": 0, "height": 72, "width": 410, "imgpath": "temp/5726fe7b-25d6-43a6-a50d-35b5f668fbb6.png", "ocr_response": [ { "text": "aacss", "left": 80.63632202148438, "top": 29.634929656982422, "right": 236.47093200683594, "bottom": 55.28932189941406, "rate": 0.9997046589851379 }, { "text": "xxzsa", "left": 312.625, "top": 30.75, "right": 395.265625, "bottom": 55.09375, "rate": 0.997739315032959 } ] }