Spaces:
Build error
Build error
debu das
commited on
Commit
·
fb87466
1
Parent(s):
5f12024
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,6 +20,7 @@ from transformers import DetrFeatureExtractor
|
|
| 20 |
from transformers import TableTransformerForObjectDetection
|
| 21 |
import torch
|
| 22 |
import asyncio
|
|
|
|
| 23 |
# pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
|
| 24 |
|
| 25 |
|
|
@@ -41,6 +42,19 @@ async def pytess(cell_pil_img):
|
|
| 41 |
print("pytess_output######################################")
|
| 42 |
print(pytess_output)
|
| 43 |
print("pytess_output@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
return pytess_output
|
| 45 |
|
| 46 |
# def super_res(pil_img):
|
|
|
|
| 20 |
from transformers import TableTransformerForObjectDetection
|
| 21 |
import torch
|
| 22 |
import asyncio
|
| 23 |
+
import paddlehub as hub
|
| 24 |
# pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
|
| 25 |
|
| 26 |
|
|
|
|
| 42 |
print("pytess_output######################################")
|
| 43 |
print(pytess_output)
|
| 44 |
print("pytess_output@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
|
| 45 |
+
print("paddleocr$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
|
| 46 |
+
###paddleocr
|
| 47 |
+
paddle_output=' '
|
| 48 |
+
cell_cv_img=PIL_to_cv(cell_pil_img)
|
| 49 |
+
ocr = PaddleOCR(use_angle_cls=True, lang=lang) # need to run only once to download and load model into memory
|
| 50 |
+
result = ocr.ocr(cell_cv_img, cls=True)
|
| 51 |
+
for idx in range(len(result)):
|
| 52 |
+
res = result[idx]
|
| 53 |
+
for line in res:
|
| 54 |
+
print(line)
|
| 55 |
+
paddle_output=paddle_output.join(line)
|
| 56 |
+
print(paddle_output)
|
| 57 |
+
print("paddleocr******************************************")
|
| 58 |
return pytess_output
|
| 59 |
|
| 60 |
# def super_res(pil_img):
|