MCPcopy Create free account
hub / github.com/alpha2phi/python-apps / test_model

Method test_model

ocr-viewer/backend/tests/test_ocr.py:17–42  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

15 pass
16
17 def test_model(self):
18 # Images
19 imgs = [
20 "backend/test_images/image_1.png",
21 "backend/test_images/image_2.jpg",
22 "backend/test_images/image_3.png",
23 "backend/test_images/image_4.jpg",
24 "backend/test_images/image_5.jpg",
25 ]
26 img = Image.open(imgs[2])
27
28 # Simple image to string
29 print(pytesseract.image_to_string(img))
30
31 # List of available languages
32 # print(pytesseract.get_languages(config=""))
33
34 # Get verbose data including boxes, confidences, line and page numbers
35 print(pytesseract.image_to_data(img))
36
37 # Chinese Simplified
38 print(
39 pytesseract.image_to_string(
40 "backend/test_images/image_5.jpg", lang="chi_sim"
41 )
42 )

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected