Process a PIL image.
(img)
| 5 | |
| 6 | |
| 7 | def recognize(img): |
| 8 | """Process a PIL image.""" |
| 9 | img_arr = np.array(img) |
| 10 | result = ocr.ocr(img_arr, cls=True) |
| 11 | |
| 12 | if result is not None and len(result) > 0: |
| 13 | boxes = [line[0] for line in result] |
| 14 | txts = [line[1][0] for line in result] |
| 15 | scores = [line[1][1] for line in result] |
| 16 | processed_img = draw_ocr( |
| 17 | img, boxes, txts, scores, font_path="./fonts/simfang.ttf" |
| 18 | ) |
| 19 | return result, processed_img |
| 20 | |
| 21 | return result, "" |
nothing calls this directly
no outgoing calls
no test coverage detected