pragnakalp commited on
Commit
54b93d3
1 Parent(s): c767653

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -17,13 +17,16 @@ from datasets import load_dataset, Image
17
  from PIL import Image
18
  from paddleocr import PaddleOCR
19
  from save_data import flag
 
20
 
21
  """
22
  Paddle OCR
23
  """
 
24
  def ocr_with_paddle(img):
25
  finaltext = ''
26
- ocr = PaddleOCR(lang='en', use_angle_cls=True)
 
27
  # img_path = 'exp.jpeg'
28
  result = ocr.ocr(img)
29
 
@@ -32,6 +35,7 @@ def ocr_with_paddle(img):
32
  finaltext += ' '+ text
33
  return finaltext
34
 
 
35
  """
36
  Keras OCR
37
  """
 
17
  from PIL import Image
18
  from paddleocr import PaddleOCR
19
  from save_data import flag
20
+ import spaces
21
 
22
  """
23
  Paddle OCR
24
  """
25
+ @spaces.GPU
26
  def ocr_with_paddle(img):
27
  finaltext = ''
28
+ paddle.set_device('gpu')
29
+ ocr = PaddleOCR(lang='en',use_angle_cls=True)
30
  # img_path = 'exp.jpeg'
31
  result = ocr.ocr(img)
32
 
 
35
  finaltext += ' '+ text
36
  return finaltext
37
 
38
+
39
  """
40
  Keras OCR
41
  """