Ahsen Khaliq
commited on
Commit
·
9a175ed
1
Parent(s):
047007f
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,16 +1,11 @@
|
|
| 1 |
-
#!/usr/bin/python
|
| 2 |
-
# -*- coding: utf-8 -*-
|
| 3 |
from paddleocr import PaddleOCR, draw_ocr
|
| 4 |
from PIL import Image
|
| 5 |
import gradio as gr
|
| 6 |
ocr = PaddleOCR(use_angle_cls=True, lang='en')
|
| 7 |
|
| 8 |
-
|
| 9 |
def inference(img):
|
| 10 |
img_path = img.name
|
| 11 |
result = ocr.ocr(img_path, cls=True)
|
| 12 |
-
for line in result:
|
| 13 |
-
print line
|
| 14 |
image = Image.open(img_path).convert('RGB')
|
| 15 |
boxes = [line[0] for line in result]
|
| 16 |
txts = [line[1][0] for line in result]
|
|
|
|
|
|
|
|
|
|
| 1 |
from paddleocr import PaddleOCR, draw_ocr
|
| 2 |
from PIL import Image
|
| 3 |
import gradio as gr
|
| 4 |
ocr = PaddleOCR(use_angle_cls=True, lang='en')
|
| 5 |
|
|
|
|
| 6 |
def inference(img):
|
| 7 |
img_path = img.name
|
| 8 |
result = ocr.ocr(img_path, cls=True)
|
|
|
|
|
|
|
| 9 |
image = Image.open(img_path).convert('RGB')
|
| 10 |
boxes = [line[0] for line in result]
|
| 11 |
txts = [line[1][0] for line in result]
|