Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -48,7 +48,7 @@ Paddle OCR
|
|
48 |
"""
|
49 |
def ocr_with_paddle(img):
|
50 |
finaltext = ''
|
51 |
-
ocr = PaddleOCR(lang='
|
52 |
# img_path = 'exp.jpeg'
|
53 |
result = ocr.ocr(img)
|
54 |
|
@@ -84,7 +84,7 @@ def ocr_with_easy(img):
|
|
84 |
gray_scale_image=get_grayscale(img)
|
85 |
thresholding(gray_scale_image)
|
86 |
cv2.imwrite('image.png',gray_scale_image)
|
87 |
-
reader = easyocr.Reader(['
|
88 |
bounds = reader.readtext('image.png',paragraph="False",detail = 0)
|
89 |
bounds = ''.join(bounds)
|
90 |
return bounds
|
@@ -126,7 +126,7 @@ Create user interface for OCR demo
|
|
126 |
|
127 |
# image = gr.Image(shape=(300, 300))
|
128 |
image = gr.File(label="Upload PDF/Image")
|
129 |
-
method = gr.Radio(["PaddleOCR","EasyOCR", "
|
130 |
output = gr.Textbox(label="Output")
|
131 |
|
132 |
demo = gr.Interface(
|
|
|
48 |
"""
|
49 |
def ocr_with_paddle(img):
|
50 |
finaltext = ''
|
51 |
+
ocr = PaddleOCR(lang='fa', use_angle_cls=True)
|
52 |
# img_path = 'exp.jpeg'
|
53 |
result = ocr.ocr(img)
|
54 |
|
|
|
84 |
gray_scale_image=get_grayscale(img)
|
85 |
thresholding(gray_scale_image)
|
86 |
cv2.imwrite('image.png',gray_scale_image)
|
87 |
+
reader = easyocr.Reader(['fa','en'])
|
88 |
bounds = reader.readtext('image.png',paragraph="False",detail = 0)
|
89 |
bounds = ''.join(bounds)
|
90 |
return bounds
|
|
|
126 |
|
127 |
# image = gr.Image(shape=(300, 300))
|
128 |
image = gr.File(label="Upload PDF/Image")
|
129 |
+
method = gr.Radio(["PaddleOCR","EasyOCR", "tesseract"],value="PaddleOCR")
|
130 |
output = gr.Textbox(label="Output")
|
131 |
|
132 |
demo = gr.Interface(
|