Script to run Google VisionΒΆ

#!/usr/bin/env python

# Run Google OCR on the US weathermap sample image

import pickle

from import vision
from import types
from google.protobuf import json_format

# Load the jpeg
with open("../../../samples/US_Weather_map_19150814.jpg",'rb') as jf:

# Analyze the document
image = types.Image(content=ie)
client = vision.ImageAnnotatorClient()
response = client.document_text_detection(image=image)
document = response.full_text_annotation

# Save the resulting JSON
pickle.dump(document, open( "detection.pkl", "wb" ) )
with open('detection.txt', 'w') as file: