hzu3fpttmzp2/test03/visualsegmenter
1
--

Run with API

See our complete quickstart for how to get started with our API in minutes.


from clarifai.client.model import Model

image_url = "https://s3.amazonaws.com/samples.clarifai.com/people_walking2.jpeg"

model_url = "https://clarifai.com/hzu3fpttmzp2/test03/models/visualsegmenter"
model_prediction = Model(url=model_url,pat="YOUR_PAT_HERE").predict_by_url(image_url)

regions = model_prediction.outputs[0].data.regions
for region in regions:
    for concept in region.data.concepts:
        # Accessing and rounding the concept's percentage of image covered
        name = concept.name
        value = round(concept.value, 4)
        print((f"{name}: {value}"))