Spaces:
Runtime error
Runtime error
add app
Browse files
main.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OCR
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
files = os.listdir('./testcase_source')
|
| 5 |
+
|
| 6 |
+
# Filter the list to include only text files
|
| 7 |
+
image_files = [file for file in files if file.endswith('.jpg')]
|
| 8 |
+
|
| 9 |
+
# Loop over the text files
|
| 10 |
+
check = 0
|
| 11 |
+
|
| 12 |
+
for img in image_files:
|
| 13 |
+
|
| 14 |
+
#Process image, them write result and log
|
| 15 |
+
print("Processing: " + img)
|
| 16 |
+
|
| 17 |
+
# Below will check special testcase you concern
|
| 18 |
+
# if (img == "X51006619503.jpg"):
|
| 19 |
+
# check = 1
|
| 20 |
+
# if (check == 0 ):
|
| 21 |
+
# print("Pass")
|
| 22 |
+
# continue
|
| 23 |
+
|
| 24 |
+
OCR.OCRText(img)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
#### ERROR ########
|
| 29 |
+
# X51006619503.jpg
|
| 30 |
+
# X51006619506.jpg
|
| 31 |
+
# X51006619782
|
| 32 |
+
# X51006619784.jpg
|
| 33 |
+
# X51006620182.jpg
|
| 34 |
+
# X51006620182.jpg
|
| 35 |
+
#
|
| 36 |
+
#
|
| 37 |
+
#
|
| 38 |
+
#
|
| 39 |
+
#
|
| 40 |
+
#
|
| 41 |
+
# #
|
| 42 |
+
|