Skip to content

Instantly share code, notes, and snippets.

@NickEngmann
Created August 22, 2018 07:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NickEngmann/410a16eb532d0f369febfe4cf47f8b9f to your computer and use it in GitHub Desktop.
Save NickEngmann/410a16eb532d0f369febfe4cf47f8b9f to your computer and use it in GitHub Desktop.
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