radames commited on
Commit
e871a21
1 Parent(s): 7f0fbd3
Files changed (4) hide show
  1. app.py +24 -0
  2. eurotext.png +0 -0
  3. packages.txt +1 -0
  4. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ try:
2
+ import Image
3
+ except ImportError:
4
+ from PIL import Image
5
+ import pytesseract
6
+
7
+ # If you don't have tesseract executable in your PATH, include the following:
8
+ # pytesseract.pytesseract.tesseract_cmd = r'<full_path_to_your_tesseract_executable>'
9
+ # Example tesseract_cmd = r'C:\Program Files (x86)\Tesseract-OCR\tesseract'
10
+
11
+ # Simple image to string
12
+ print(pytesseract.image_to_string(Image.open('eurotext.png')))
13
+
14
+ # # French text image to string
15
+ # print(pytesseract.image_to_string(Image.open('test-european.jpg'), lang='fra'))
16
+
17
+ # # Get bounding box estimates
18
+ # print(pytesseract.image_to_boxes(Image.open('test.png')))
19
+
20
+ # # Get verbose data including boxes, confidences, line and page numbers
21
+ # print(pytesseract.image_to_data(Image.open('test.png')))
22
+
23
+ # # Get information about orientation and script detection
24
+ # print(pytesseract.image_to_osd(Image.open('test.png'))
eurotext.png ADDED
packages.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ tesseract-ocr-all
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio
2
+ pytesseract