Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -12,9 +12,11 @@ torch.hub.download_url_to_file('https://i.imgur.com/aqMBT0i.jpg', 'example.jpg')
|
|
12 |
def inference(img, lang):
|
13 |
ocr = PaddleOCR(use_angle_cls=True, lang=lang,use_gpu=False)
|
14 |
img_path = img
|
15 |
-
result = ocr.ocr(img_path, cls=True)[0]
|
|
|
16 |
# image = Image.open(img_path).convert('RGB')
|
17 |
-
boxes = [line[0] for line in result]
|
|
|
18 |
txts = [line[1][0] for line in result]
|
19 |
return '\n'.join(txts)
|
20 |
# scores = [line[1][1] for line in result]
|
|
|
12 |
def inference(img, lang):
|
13 |
ocr = PaddleOCR(use_angle_cls=True, lang=lang,use_gpu=False)
|
14 |
img_path = img
|
15 |
+
# result = ocr.ocr(img_path, cls=True)[0] # 2.9
|
16 |
+
result = ocr.infer(img_path, cls=True)[0]
|
17 |
# image = Image.open(img_path).convert('RGB')
|
18 |
+
# boxes = [line[0] for line in result]
|
19 |
+
print(result) #debug
|
20 |
txts = [line[1][0] for line in result]
|
21 |
return '\n'.join(txts)
|
22 |
# scores = [line[1][1] for line in result]
|