Loca Visual Prompt Counting
A tool that counts the dominant foreground object given an image and a visual prompt which is a bounding box describing the object. It returns only the count of the objects in the image.
Output
python
import requests
import base64
url = "https://api.landing.ai/v1/tools/loca"
with open("{{path_to_image}}", "rb") as image_file:
base64_string = base64.b64encode(image_file.read()).decode('utf-8')
payload = {
"image": base64_string,
"bbox": [ {{x1}}, {{y1}}, {{x2}}, {{y2}} ],
"function_name": "loca_visual_prompt_counting"
}
headers = {
"Content-Type": "application/json",
"Accept": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())