Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,8 @@ from paddleocr import PaddleOCR, draw_ocr
|
|
6 |
from PIL import Image
|
7 |
import gradio as gr
|
8 |
|
|
|
|
|
9 |
def download_image(url, save_path):
|
10 |
"""
|
11 |
Download an image from a specified URL and save it to the specified path
|
@@ -37,7 +39,7 @@ image_url = "https://raw.githubusercontent.com/PaddlePaddle/PaddleOCR/v2.8.0/doc
|
|
37 |
download_image(image_url, "example.jpg")
|
38 |
|
39 |
def inference(img, lang):
|
40 |
-
|
41 |
img_path = img
|
42 |
result = ocr.ocr(img_path, cls=True)[0]
|
43 |
image = Image.open(img_path).convert('RGB')
|
|
|
6 |
from PIL import Image
|
7 |
import gradio as gr
|
8 |
|
9 |
+
ocr = PaddleOCR(use_angle_cls=True, lang=lang,use_gpu=False)
|
10 |
+
|
11 |
def download_image(url, save_path):
|
12 |
"""
|
13 |
Download an image from a specified URL and save it to the specified path
|
|
|
39 |
download_image(image_url, "example.jpg")
|
40 |
|
41 |
def inference(img, lang):
|
42 |
+
|
43 |
img_path = img
|
44 |
result = ocr.ocr(img_path, cls=True)[0]
|
45 |
image = Image.open(img_path).convert('RGB')
|