Spaces:
Build error
Build error
mohamed12ahmed
commited on
Commit
•
6cc9b2d
1
Parent(s):
4c09117
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pytesseract
|
2 |
+
import shutil
|
3 |
+
import os
|
4 |
+
import random
|
5 |
+
try:
|
6 |
+
from PIL import Image
|
7 |
+
except ImportError:
|
8 |
+
import Image
|
9 |
+
pytesseract.pytesseract.tesseract_cmd = (
|
10 |
+
r'/usr/bin/tesseract'
|
11 |
+
)
|
12 |
+
import imutils
|
13 |
+
import re
|
14 |
+
import cv2
|
15 |
+
import numpy as np
|
16 |
+
import pytesseract
|
17 |
+
from pytesseract import Output
|
18 |
+
from matplotlib import pyplot as plt
|
19 |
+
from pytesseract import image_to_string
|
20 |
+
|
21 |
+
# Get OCR output using Pytesseract
|
22 |
+
image_path_in_colab='/content/sample4.jpg'
|
23 |
+
#extract = pytesseract.image_to_string(Image.open(image_path_in_colab))
|
24 |
+
|
25 |
+
custom_config = r'--oem 3 --psm 6'
|
26 |
+
imagetext = pytesseract.image_to_string(image_path_in_colab)
|