pragnakalp commited on
Commit
a6fc706
1 Parent(s): 0b14880

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -18,7 +18,15 @@ from PIL import Image
18
  from paddleocr import PaddleOCR
19
  from save_data import flag
20
  import spaces
21
-
 
 
 
 
 
 
 
 
22
  """
23
  Paddle OCR
24
  """
@@ -59,6 +67,8 @@ def get_grayscale(image):
59
  # Thresholding or Binarization
60
  def thresholding(src):
61
  return cv2.threshold(src,127,255, cv2.THRESH_TOZERO)[1]
 
 
62
  def ocr_with_easy(img):
63
  gray_scale_image=get_grayscale(img)
64
  thresholding(gray_scale_image)
 
18
  from paddleocr import PaddleOCR
19
  from save_data import flag
20
  import spaces
21
+
22
+ gpus = tf.config.experimental.list_physical_devices('GPU')
23
+ if gpus:
24
+ try:
25
+ for gpu in gpus:
26
+ tf.config.experimental.set_memory_growth(gpu, True)
27
+ except RuntimeError as e:
28
+ print(e)
29
+
30
  """
31
  Paddle OCR
32
  """
 
67
  # Thresholding or Binarization
68
  def thresholding(src):
69
  return cv2.threshold(src,127,255, cv2.THRESH_TOZERO)[1]
70
+
71
+ @spaces.GPU
72
  def ocr_with_easy(img):
73
  gray_scale_image=get_grayscale(img)
74
  thresholding(gray_scale_image)