Spaces:
Sleeping
Sleeping
Update app.py
Browse files6 unmodified lines789101011121386 unmodified lines10010110210310310410510610710810810911011145 unmodified lines1571581591601601611621636 unmodified linesimport pickleimport matplotlib.pyplot as pltimport matplotlib.font_manager as fm# import sakshi_ocr# import py_text_scanimport osimport ioimport sys86 unmodified lines return word_img, word_count
# Sakshi OCR output capturedef run_sakshi_ocr(image_path):def run_py_text_scan(image_path): buffer = io.StringIO() old_stdout = sys.stdout sys.stdout = buffer try: sakshi_ocr.generate(image_path) py_text_scan.generate(image_path) finally: sys.stdout = old_stdout return buffer.getvalue()45 unmodified lines # Sakshi OCR processing with tempfile.NamedTemporaryFile(delete=False, suffix=".png") as tmp_file: cv2.imwrite(tmp_file.name, img) sakshi_output = run_sakshi_ocr(tmp_file.name) sakshi_output = run_py_text_scan(tmp_file.name) os.unlink(tmp_file.name) return {app.py+4-4