Tag
Ask questions
Ask our model a question about your images
Google Colab
Try the example Jupyter notebook
Github
Find basic integration code on Github (Python)
Webapp
Quickly try our interactive webapp
You will need an API token to send HTTP requests. See Authentication for instructions.
Quick start
Firstly, you'll need to convert the image you want to process to a Base64 string (with UTF-8 encoding). You can then send it in the request along with the question you want to ask.
{
"base64": "/9j/4QIiRX...",
"question": "Is the image good for a blog post?"
}Please note that we only support the following formats: WEBP, JPEG and PNG.
{
"data": "Yes, the image of a man wearing a crown and glasses is a good choice for a blog post..."
}Asking questions on images
Our advanced Vision Language Model (VLM) can easily answer questions regarding images you send to our API. Try asking anything you want!
import requests
api_url = "https://api.piktid.com/api"
access_token = "your_access_token"
target_path = "path_to_image"
question = "Is this image the right format for a poster?"
def open_image_from_file_to_base64(image_path):
with open(image_path, "rb") as image_file:
data_base64 = base64.b64encode(image_file.read())
return data_base64
response = requests.post(
api_url + "/getQuestion",
headers={"Authorization": "Bearer " + access_token},
json={
"base64": open_image_from_file_to_base64(target_path).decode("utf8"),
"question": question,
},
).json()
print(response["data"])