2

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))
Math-fort
  • 101
  • 11
  • Well, web services aren't really meant to work offline – OneCricketeer Feb 09 '18 at 13:24
  • 2
    Possible duplicate of [Does Machine Vision API work offline?](https://stackoverflow.com/questions/40832882/does-machine-vision-api-work-offline) – cyberbemon Feb 09 '18 at 13:25
  • [Does Machine Vision API work offline? ](https://stackoverflow.com/questions/40832882/does-machine-vision-api-work-offline) is about android app. – Math-fort Feb 09 '18 at 14:55

0 Answers0