debu das commited on
Commit
7fa0911
1 Parent(s): 9fa69a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -12
app.py CHANGED
@@ -47,18 +47,20 @@ async def pytess(cell_pil_img):
47
  ###paddleocr
48
  paddle_output=' '
49
  cell_cv_img=PIL_to_cv(cell_pil_img)
50
- ocr = PaddleOCR(use_angle_cls=True,use_space_char=True) # need to run only once to download and load model into memory
51
- result = ocr.ocr(cell_cv_img,cls=True)
52
- print(result)
53
- print("___________________________________________________________")
54
- for idx in range(len(result)):
55
- res = result[idx]
56
- for line in res:
57
- print(line)
58
- print(line[1][0])
59
- print("____________________________@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
60
- paddle_output=paddle_output+' '+line[1][0]
61
- paddle_output=paddle_output+' '
 
 
62
  print("paddleocr@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
63
  print(paddle_output)
64
  print("paddleocr$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
 
47
  ###paddleocr
48
  paddle_output=' '
49
  cell_cv_img=PIL_to_cv(cell_pil_img)
50
+ height, width, channels = cell_cv_img.shape
51
+ if height>=2000 and width>=2000:
52
+ ocr = PaddleOCR(use_angle_cls=True,use_space_char=True) # need to run only once to download and load model into memory
53
+ result = ocr.ocr(cell_cv_img,cls=True)
54
+ print(result)
55
+ print("___________________________________________________________")
56
+ for idx in range(len(result)):
57
+ res = result[idx]
58
+ for line in res:
59
+ print(line)
60
+ print(line[1][0])
61
+ print("____________________________@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
62
+ paddle_output=paddle_output+' '+line[1][0]
63
+ paddle_output=paddle_output+' '
64
  print("paddleocr@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
65
  print(paddle_output)
66
  print("paddleocr$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")