sameernotes commited on
Commit
3472658
·
verified ·
1 Parent(s): d33862c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -7,7 +7,7 @@ import tensorflow as tf
7
  import pickle
8
  import matplotlib.pyplot as plt
9
  import matplotlib.font_manager as fm
10
- # import sakshi_ocr
11
  import os
12
  import io
13
  import sys
@@ -100,12 +100,12 @@ def detect_words(image):
100
  return word_img, word_count
101
 
102
  # Sakshi OCR output capture
103
- def run_sakshi_ocr(image_path):
104
  buffer = io.StringIO()
105
  old_stdout = sys.stdout
106
  sys.stdout = buffer
107
  try:
108
- sakshi_ocr.generate(image_path)
109
  finally:
110
  sys.stdout = old_stdout
111
  return buffer.getvalue()
@@ -157,7 +157,7 @@ def process_image(image_array):
157
  # Sakshi OCR processing
158
  with tempfile.NamedTemporaryFile(delete=False, suffix=".png") as tmp_file:
159
  cv2.imwrite(tmp_file.name, img)
160
- sakshi_output = run_sakshi_ocr(tmp_file.name)
161
  os.unlink(tmp_file.name)
162
 
163
  return {
 
7
  import pickle
8
  import matplotlib.pyplot as plt
9
  import matplotlib.font_manager as fm
10
+ # import py_text_scan
11
  import os
12
  import io
13
  import sys
 
100
  return word_img, word_count
101
 
102
  # Sakshi OCR output capture
103
+ def run_py_text_scan(image_path):
104
  buffer = io.StringIO()
105
  old_stdout = sys.stdout
106
  sys.stdout = buffer
107
  try:
108
+ py_text_scan.generate(image_path)
109
  finally:
110
  sys.stdout = old_stdout
111
  return buffer.getvalue()
 
157
  # Sakshi OCR processing
158
  with tempfile.NamedTemporaryFile(delete=False, suffix=".png") as tmp_file:
159
  cv2.imwrite(tmp_file.name, img)
160
+ sakshi_output = run_py_text_scan(tmp_file.name)
161
  os.unlink(tmp_file.name)
162
 
163
  return {