Skip to content

Instantly share code, notes, and snippets.

@NickEngmann NickEngmann/tags.py
Created Aug 22, 2018

Embed
What would you like to do?
Snapshop code changes for Major League Hacking
#!flask/bin/python
from clarifai.rest import ClarifaiApp
from clarifai.rest import Image as ClImage
app = ClarifaiApp(api_key='YOUR_API_KEY')
# import a few labelled images
def main():
app = ClarifaiApp(api_key='YOUR_API_KEY')
def get_tags(image_url):
model = app.models.get('general-v1.3')
image = ClImage(url=image_url)
response = model.predict([image])
concepts = response['outputs'][0]['data']['concepts']
model = app.models.get('laptops')
model.model_version = 'MODEL_VERSION_ID'
custom_response = model.predict([image])
custom_concepts = custom_response['outputs'][0]['data']['concepts']
concepts = custom_concepts + concepts
return concepts;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.