Skip to content
Snippets Groups Projects

Azure Computer Vision Client

A Python client to make Azure Computer Vision requests.

Requirements

A Microsoft Azure account with a computer vision resource.

Python >= 3.8

*Note: Package has only been tested on a 64bit Linux system.

Installation

Install using pip:

pip install -U git+https://gitlab.ssec.wisc.edu/mdrexler/azureocr

Install from source:

git clone https://gitlab.ssec.wisc.edu/mdrexler/azureocr.git
cd azureocr
python setup.py install

Usage

Quick Use:

from azvision import scan

img = '/path/to/img.png' or 'https:/url/to/img.png'
resp = scan(img, key=VISION_KEY, endpoint=VISION_ENDPOINT)

# prints text in image
print(resp.readResult.content)

Return type documentation here.

Create a client for improved efficiency:

from azvision import ComputerVisionClient

# use .env file or,
# have VISION_KEY and VISION_ENDPOINT in envrionment variables
client = ComputerVisionClient('path/to/file/.env')

client.scan(img)

Command Line

You can scan an image from the command line using the azscan command.

Use azscan --help for more information.

Author

Created by Max Drexler

License

MIT License. See LICENSE for more information.