Ahsen Khaliq commited on
Commit
389b598
1 Parent(s): 02fe200

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -6,6 +6,8 @@ from PIL import Image
6
  import gradio as gr
7
  ocr = PaddleOCR(use_angle_cls=True, lang='en',use_gpu=False)
8
 
 
 
9
  def inference(img):
10
  img_path = img.name
11
  result = ocr.ocr(img_path, cls=True)
@@ -23,7 +25,7 @@ def inference(img):
23
  title = 'PaddleOCR'
24
  description = 'Gradio demo for PaddleOCR. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below.'
25
  article = "<p style='text-align: center'><a href='https://www.paddlepaddle.org.cn/hub/scene/ocr'>Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)</a> | <a href='https://github.com/PaddlePaddle/PaddleOCR'>Github Repo</a></p>"
26
-
27
  gr.Interface(
28
  inference,
29
  gr.inputs.Image(type='file', label='Input'),
@@ -31,4 +33,5 @@ gr.Interface(
31
  title=title,
32
  description=description,
33
  article=article,
 
34
  ).launch(debug=True)
 
6
  import gradio as gr
7
  ocr = PaddleOCR(use_angle_cls=True, lang='en',use_gpu=False)
8
 
9
+ torch.hub.download_url_to_file('https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.3/doc/imgs_en/254.jpg', 'receipt.jpg')
10
+
11
  def inference(img):
12
  img_path = img.name
13
  result = ocr.ocr(img_path, cls=True)
 
25
  title = 'PaddleOCR'
26
  description = 'Gradio demo for PaddleOCR. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below.'
27
  article = "<p style='text-align: center'><a href='https://www.paddlepaddle.org.cn/hub/scene/ocr'>Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)</a> | <a href='https://github.com/PaddlePaddle/PaddleOCR'>Github Repo</a></p>"
28
+ examples = [['receipt.jpg']]
29
  gr.Interface(
30
  inference,
31
  gr.inputs.Image(type='file', label='Input'),
 
33
  title=title,
34
  description=description,
35
  article=article,
36
+ examples=examples
37
  ).launch(debug=True)