cxeep commited on
Commit
c083dc4
·
verified ·
1 Parent(s): b55943f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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
- torch.hub.download_url_to_file('https://i.imgur.com/aqMBT0i.jpg', 'example.jpg')
 
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.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
 
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