Perform OCR using Google's Drive API v3
Project description
Perform OCR using Google’s Drive API v3
Free software: GNU General Public License v3
Documentation: https://google-drive-ocr.readthedocs.io.
Features
Perform OCR using Google’s Drive API v3
Single, Batch and Parallel OCR
Work on a PDF document directly
Highly configurable CLI
GoogleOCRApplication
class usable in a project
Usage
Use google_drive_ocr
in a project:
from google_drive_ocr.application import GoogleOCRApplication
app = GoogleOCRApplication('client_secret.json')
# Single image
app.perform_ocr('image.png')
# Multiple images
app.perform_batch_ocr(['image_1.png', 'image_2.png', 'image_3.png'])
# Multiple Images using multiprocessing
app.perform_batch_ocr(['image_1.png', 'image_3.png', 'image_2.png'], workers=2)
Use google_drive_ocr
from command line:
google-ocr --client-secret client_secret.json \
--upload-folder-id <google-drive-folder-id> \
--image-dir images/ --extension .jpg \
--workers 4 --no-keep
# Save configuration and exit
# If configuration is written to ~/.gdo.cfg, we don't have to specify those
# options again on the subsequent runs
google-ocr --client-secret client_secret.json --write-config ~/.gdo.cfg
# Read configuration from a custom location (if it was written to a custom location)
google-ocr --config ~/.my_config_file ..
# Examples (assuming client-secret is saved in configuration file)
# Single image
google-ocr -i image.png
# Multiple images
google-ocr -b image_1.png image_2.png image_3.png
# All files from a directory
google-ocr --image-dir images/ --extension .png
# Multiple images using multiprocessing
google-ocr -b image_1.png image_2.png image_3.png --workers 2
# PDF files
google-ocr --pdf document.pdf --pages 1-3 5 7-10 13
# For more detailed Usage
google-ocr --help
Note:
You must setup a Google application and download client_secrets.json
file before using google_drive_ocr
.
Setup Instructions
Create a project on Google Cloud Platform
Wizard: https://console.developers.google.com/start/api?id=drive
Instructions:
https://cloud.google.com/genomics/downloading-credentials-for-api-access
Select application type as “Installed Application”
Create credentials OAuth consent screen –> OAuth client ID
Save
client_secret.json
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.2.0 (2021-06-29)
PDF file support
0.1.0 (2021-06-14)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for google_drive_ocr-0.2.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d62ca41914c6b54d8caa70ad1f6a5339f432112bf58701f12d7d41cb779e8fd6 |
|
MD5 | a98e67f02e0c4c44dcfd44194ee23461 |
|
BLAKE2b-256 | 4914cde21582153a9d80d470987f457916d7f1f4f6ceaf057eda23968286758e |