I have a simple Python application which uses Google vision API. How can I make it to work offline? I searched a lot but couldn't find anything useful. This question is about android app and it seems that for that case the answer is positive. Here is my code:
from google.cloud import vision
from google.cloud.vision import types
from google.oauth2 import service_account
credentials=service_account.Credentials.from_service_account_file('key.json')
client = vision.ImageAnnotatorClient(credentials=credentials)
with io.open('my_figure.jpg', 'rb') as image_file:
content = image_file.read()
image_context = types.ImageContext(language_hints =["en"])
image = types.Image(content=content)
response = client.text_detection(image=image, image_context=image_context)
texts = response.text_annotations
for text in texts:
print('\n"{}"'.format(text.description))