Last active
August 26, 2018 03:42
-
-
Save khuangaf/37394b1ff250c4a10b10844e2528d98e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the endpoint of the api | |
ENDPOINT_URL = 'https://vision.googleapis.com/v1p1beta1/images:annotate' | |
# the api key | |
os.environ['GOOGLE_APPLICATION_CREDENTIALS']='your/path/to/credentials.json' | |
# init api client | |
client = vision.ImageAnnotatorClient() | |
with io.open(YOUR_IMAGE_PATH, 'rb') as f: | |
content = f.read() | |
image = vision.types.Image(content=content) | |
image_context = vision.types.ImageContext(language_hints=['zh-TW']) | |
response = client.document_text_detection(image=image,image_context=image_context) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment