Files
jwxt/ocr_captcha.py

15 lines
315 B
Python

import ddddocr, base64, json
with open("captcha_b64.txt") as f:
b64 = f.read().strip()
img = base64.b64decode(b64)
with open("captcha_new.png", "wb") as f:
f.write(img)
ocr = ddddocr.DdddOcr(show_ad=False)
with open("captcha_new.png", "rb") as f:
result = ocr.classification(f.read())
print(result)