I'm using Clarifai's API in Python to get concept names from a photo and would like to determine if any of them match a local variable. The following command invokes a list:
In [1]: p1_response = model.predict_by_filename(filename='PATH_TO_FILE')
p1_concepts = p1_response['outputs'][0]['data']['concepts']
for concept in p1_concepts:
print(concept['name'])
Out [2]: street
outdoors
architecture
travel
city
horizontal plane
pavement
road
house
town
urban
car
no person
building
stock
luxury
traffic
apartment
business
tourism
My local variable is a keyword
defined as "car"
. I tried running if keyword in concept['name']
, but my console listed 11 False
s before a True
. Effectively, I'd like to make a function that does something if there is at least one instance of keyword
in concept['name']
. If anyone would chime in, I would much appreciate the help.