0

I would like to analyse pictures from Instagram with Google Vision. Up to now, I collected posts from Instagram by hashtag. So I have a CSV/XLS where the information per post is "stored". Title, coordinates and the links to the images.

Now I used the following python script to receive the annotations (labels) from pictures (I had to download the pictures first)

import io
import os

from google.cloud import vision
from google.cloud.vision import types


os.environ["GOOGLE_APPLICATION_CREDENTIALS"]="../mycredentials.json"

vision_client=vision.ImageAnnotatorClient()
file_name = "horse.jpg"

with io.open(file_name,'rb') as image_file:
    content = image_file.read()

    image = types.Image(content=content)

    response = vision_client.label_detection(image=image)
    labels = response.label_annotations

for label in labels:
    print(label.description)

This script allows me to receive the the annotations by an individual, pre-downloaded script (here horse.jpg)

My question now: any idea of how to send the links for the images of the post-collection (in my CSV/XLS) to google vision? In other words, not to download pictures first and analyse them via API one by one, but just using the Links and than receive the annotations automatically for all picture-links in the CSV?

Filnor
  • 1,290
  • 2
  • 23
  • 28
Roman Egger
  • 13
  • 1
  • 5
  • Sorry I can't test it right now. But I think you can provide the URL to the image with this line of code `image = types.Image(source='image_url') ` https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/types.html#google.cloud.vision_v1.types.Image – p13rr0m Oct 17 '18 at 07:57
  • thank you - however that didn´t work for me.... – Roman Egger Oct 17 '18 at 17:28

0 Answers0