Recognize captcha through ddddocr

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

Recognize captcha through ddddocr

How to install

pip install ddddocr

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())
Recognize captcha through ddddocr
Like (0)
EvanEvan
Previous January 4, 2024 10:11 am
Next January 31, 2024 4:29 pm

Leave a Reply

Your email address will not be published. Required fields are marked *