Kaushik Bar commited on
Commit
50513ee
·
1 Parent(s): 1bfc7fb
Files changed (1) hide show
  1. app.py +4 -12
app.py CHANGED
@@ -1,13 +1,8 @@
1
- #import os
2
- #os.system('pip install paddlepaddle')
3
- #os.system('pip install paddleocr')
4
  from paddleocr import PaddleOCR, draw_ocr
5
  from PIL import Image
6
  import gradio as gr
7
  import torch
8
 
9
- #torch.hub.download_url_to_file('https://i.imgur.com/aqMBT0i.jpg', 'example.jpg')
10
-
11
  def inference(img, lang):
12
  ocr = PaddleOCR(use_angle_cls=True, lang=lang,use_gpu=False)
13
  img_path = img.name
@@ -22,10 +17,8 @@ def inference(img, lang):
22
  im_show.save('result.jpg')
23
  return 'result.jpg'
24
 
25
- title = 'PaddleOCR'
26
- description = 'Gradio demo for PaddleOCR. PaddleOCR demo supports Chinese, English, French, German, Korean and Japanese.To use it, simply upload your image and choose a language from the dropdown menu. 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 = [['example.jpg','en']]
29
  css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
30
  gr.Interface(
31
  inference,
@@ -33,8 +26,7 @@ gr.Interface(
33
  gr.outputs.Image(type='file', label='Output'),
34
  title=title,
35
  description=description,
36
- article=article,
37
- #examples=examples,
38
  css=css,
39
  enable_queue=True
40
- ).launch(debug=True)
 
 
 
 
 
1
  from paddleocr import PaddleOCR, draw_ocr
2
  from PIL import Image
3
  import gradio as gr
4
  import torch
5
 
 
 
6
  def inference(img, lang):
7
  ocr = PaddleOCR(use_angle_cls=True, lang=lang,use_gpu=False)
8
  img_path = img.name
 
17
  im_show.save('result.jpg')
18
  return 'result.jpg'
19
 
20
+ title = 'OCR'
21
+ description = 'OCR demo (supports Chinese, English, French, German, Korean and Japanese). Simply upload your image and choose a language from the dropdown menu.'
 
 
22
  css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}"
23
  gr.Interface(
24
  inference,
 
26
  gr.outputs.Image(type='file', label='Output'),
27
  title=title,
28
  description=description,
 
 
29
  css=css,
30
  enable_queue=True
31
+ ).launch(debug=True)
32
+