Perform OCR using Google's Drive API v3
Project description
Google OCR (Drive API v3)
Perform OCR using Google’s Drive API v3
Free software: GNU General Public License v3
Documentation: https://google-drive-ocr.readthedocs.io.
Usage
To 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)
To 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 # 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
Features
Perform OCR using Google’s Drive API v3
Single, Batch and Parallel OCR
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
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.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0c73805a413c64d12b921b28bac592726ca6e8a11365d1d5dd07fcf593d24c5 |
|
MD5 | 989c43f22e522931df10e4633f1e0fe9 |
|
BLAKE2b-256 | cc582008514982ae2c9deddf629afa41a34b94aa3771212509f0daf9cc978d9e |