Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.txt
*.log
15 changes: 9 additions & 6 deletions google-ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
import os


types = ['*.jpg','*.png','*.pdf']
files = []
for filename in glob.glob('*.jpg'):
files.append(filename)

for image in sorted(files):
print "uploading " + image
command = "gdput.py -t ocr " + image + " > result.log"
for type_ in types:
for filename in glob.glob(type_):
files.append(filename)

for file in sorted(files):
print "uploading " + file
command = "gdput.py -t ocr " + file + " > result.log"
print "running " + command
os.system(command)

Expand All @@ -17,7 +20,7 @@
for line in resultfile:
if "id:" in line:
fileid = line.split(":")[1].strip()
filename = image.split(".")[0] + ".txt"
filename = file.split(".")[0] + ".txt"
get_command = "gdget.py -f txt -s " + filename + " " + fileid
print "running "+ get_command
os.system(get_command)
Expand Down
Binary file added sample1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sample2.pdf
Binary file not shown.