Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,10 +17,10 @@ from datasets import load_dataset, Image
|
|
| 17 |
from PIL import Image
|
| 18 |
from paddleocr import PaddleOCR
|
| 19 |
from save_data import flag
|
| 20 |
-
import spaces
|
| 21 |
import pytesseract
|
| 22 |
from PIL import Image
|
| 23 |
-
import torch
|
| 24 |
|
| 25 |
"""
|
| 26 |
Paddle OCR
|
|
@@ -44,9 +44,9 @@ Keras OCR
|
|
| 44 |
# @spaces.GPU
|
| 45 |
def ocr_with_keras(img):
|
| 46 |
output_text = ''
|
| 47 |
-
pipeline=keras_ocr.pipeline.Pipeline()
|
| 48 |
images=[keras_ocr.tools.read(img)]
|
| 49 |
-
predictions=pipeline.recognize(images)
|
| 50 |
first=predictions[0]
|
| 51 |
for text,box in first:
|
| 52 |
output_text += ' '+ text
|
|
@@ -76,7 +76,7 @@ def ocr_with_easy(img):
|
|
| 76 |
"""
|
| 77 |
Generate OCR
|
| 78 |
"""
|
| 79 |
-
@spaces.GPU
|
| 80 |
def generate_ocr(Method,img):
|
| 81 |
|
| 82 |
text_output = ''
|
|
|
|
| 17 |
from PIL import Image
|
| 18 |
from paddleocr import PaddleOCR
|
| 19 |
from save_data import flag
|
| 20 |
+
# import spaces
|
| 21 |
import pytesseract
|
| 22 |
from PIL import Image
|
| 23 |
+
# import torch
|
| 24 |
|
| 25 |
"""
|
| 26 |
Paddle OCR
|
|
|
|
| 44 |
# @spaces.GPU
|
| 45 |
def ocr_with_keras(img):
|
| 46 |
output_text = ''
|
| 47 |
+
pipeline=keras_ocr.pipeline.Pipeline()
|
| 48 |
images=[keras_ocr.tools.read(img)]
|
| 49 |
+
predictions=pipeline.recognize(images)
|
| 50 |
first=predictions[0]
|
| 51 |
for text,box in first:
|
| 52 |
output_text += ' '+ text
|
|
|
|
| 76 |
"""
|
| 77 |
Generate OCR
|
| 78 |
"""
|
| 79 |
+
# @spaces.GPU
|
| 80 |
def generate_ocr(Method,img):
|
| 81 |
|
| 82 |
text_output = ''
|