Ddddocr is an open-source OCR (Optical Character Recognition) project. With ddddocr, we can process the majority of captchas.
Github:https://github.com/sml2h3/ddddocr

How to install
pip install ddddocr
python <= 3.9, supports Windows/Linux/Macos.
Example: OCR recognition
import ddddocr
ocr = ddddocr.DdddOcr()
with open("test.jpg", 'rb') as f:
image = f.read()
res = ocr.classification(image)
print(res)
Deployment of ddddocr api
Install via docker (recommanded) ,For other installation methods, please refer to https://github.com/sml2h3/ocr_api_server
git clone https://github.com/sml2h3/ocr_api_server.git
cd ocr_api_server
# Modify the parameters in entrypoint.sh. Scroll up for specific parameters. The default port is 9898. At the same time, enable the ocr module and target detection module.
# Compile image
docker build -t ocr_server:v1
# Run image
docker run -p 9898:9898 -d ocr_server:v1
To test whether it is successful, you can directly access http://{host}:{port}/ping with GET to test. If pong is returned, it is successful.
# OCR Request
# resp = requests.post("http://{host}:{port}/ocr/file", files={'image': image_bytes})
# resp = requests.post("http://{host}:{port}/ocr/b64/text", data=base64.b64encode(file).decode())
