Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,15 +5,15 @@ import os
|
|
| 5 |
from paddleocr import PaddleOCR #, draw_ocr
|
| 6 |
from PIL import Image
|
| 7 |
import gradio as gr
|
| 8 |
-
import torch
|
| 9 |
|
| 10 |
-
|
|
|
|
| 11 |
|
| 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.
|
| 17 |
# image = Image.open(img_path).convert('RGB')
|
| 18 |
# boxes = [line[0] for line in result]
|
| 19 |
print(result) #debug
|
|
|
|
| 5 |
from paddleocr import PaddleOCR #, draw_ocr
|
| 6 |
from PIL import Image
|
| 7 |
import gradio as gr
|
|
|
|
| 8 |
|
| 9 |
+
import requests
|
| 10 |
+
open('example.jpg', 'wb').write(requests.get('https://i.imgur.com/aqMBT0i.jpg').content)
|
| 11 |
|
| 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.ocr(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
|