Skip to content

Instantly share code, notes, and snippets.

@everling-prime
Created October 25, 2018 08:32
Show Gist options
  • Save everling-prime/b57d1987c8f0e7011610bc0669ec49cf to your computer and use it in GitHub Desktop.
Save everling-prime/b57d1987c8f0e7011610bc0669ec49cf to your computer and use it in GitHub Desktop.
This function takes an image (URL) and returns a string list of tags predicted by Clarifai
from clarifai.rest import ClarifaiApp
app = ClarifaiApp()
def get_concept_tags(image_url):
response_data = app.tag_urls([image_url])
tags = []
for concept in response_data['outputs'][0]['data']['concepts']:
tags.append(concept['name'])
return tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment