Metadata-Version: 2.1
Name: google_drive_ocr
Version: 0.2.4
Summary: Perform OCR using Google's Drive API v3
Home-page: https://github.com/hrishikeshrt/google_drive_ocr
Author: Hrishikesh Terdalkar
Author-email: hrishikeshrt@linuxmail.org
License: GNU General Public License v3
Keywords: google_drive_ocr
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=3.6
License-File: LICENSE
License-File: AUTHORS.rst

=========================
Google OCR (Drive API v3)
=========================


.. image:: https://img.shields.io/pypi/v/google_drive_ocr?color=success
        :target: https://pypi.python.org/pypi/google_drive_ocr

.. image:: https://readthedocs.org/projects/google-drive-ocr/badge/?version=latest
        :target: https://google-drive-ocr.readthedocs.io/en/latest/?version=latest
        :alt: Documentation Status

.. image:: https://img.shields.io/pypi/pyversions/google_drive_ocr
        :target: https://pypi.python.org/pypi/google_drive_ocr
        :alt: Python Version Support

.. image:: https://img.shields.io/github/issues/hrishikeshrt/google_drive_ocr
        :target: https://github.com/hrishikeshrt/google_drive_ocr/issues
        :alt: GitHub Issues

.. image:: https://img.shields.io/github/followers/hrishikeshrt?style=social
        :target: https://github.com/hrishikeshrt
        :alt: GitHub Followers

.. image:: https://img.shields.io/twitter/follow/hrishikeshrt?style=social
        :target: https://twitter.com/hrishikeshrt
        :alt: Twitter Followers


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
* :code:`GoogleOCRApplication` class usable in a project

Usage
=====

Use :code:`google_drive_ocr` in a project:

.. code-block:: python

    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 :code:`google_drive_ocr` from command line:

.. code-block:: console

    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 :code:`client_secrets.json` file before using :code:`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 :code:`client_secret.json`

Credits
=======

This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage


History
=======

0.2.0 (2021-06-29)
------------------

* PDF file support

0.1.0 (2021-06-14)
------------------

* First release on PyPI.


