DOCUMENTATION

ImageChat API Guide

ImageChat API guide

About ImageChat

ImageChat is a foundation model that combines a large language model with computer vision to provide more detailed insights into visual images and textual data with staggering accuracy.

ImageChat-3 has been trained on over 11 billion parameters and a 5x image database improvement compared to previous versions. This enables improved context-based query responses, multi-language support, and better image analysis.

To learn more, read our blog “What is ImageChat.”

To get started with a free version of ImageChat, sign up for a free account.

How to use ImageChat hosted API interface

You can use the ImageChat API to access ImageChat or an integrated ImageChat and Object Detector model automatically from your system. This feature is great for continuously analyzing camera feeds, iterating through saved images or videos, or integrating into an existing system. In order to integrate ReadyNow Models with the ImageChat API, you will need an Enterprise account. Please contact us to have one set one up.

Creating custom models with ImageChat

You can add an object detector to ImageChat foundation model to gain additional accuracy and localization within an image or video frame. ImageChat combined with an object detector allows you to get more precise for greater detection accuracy and image analysis.

In order to create a custom ImageChat model, log in to your Chooch AI Vision Studio account. If you do not have an account, sign up to create one.

 

1. Select Custom Models from the left side navigation bar.

2. Make sure you are in the ImageChat tab and select Add ImageChat Model.

3. Provide a name for your new model.

ImageChat Name Model Screen

4. (Optional) Select an Object Detector from the Chooch ReadyNow catalog or from your custom models.

ImageChat Select Object Detector Screen

5. (Optional) Customize additional parameters of your object detection model such as padding, confidence, and non-max suppression.

These are useful for additional fine tuning during model testing. If you did not select an object detector, these parameter options will not appear.

ImageChat Select Object Detector Screen

6. Add a prompt (or multiple) to automate detection with your new ImageChat model.

Make sure to follow the best practices described in Prompting ImageChat to ensure the highest accuracy analysis.

ImageChat Prompt Sequence

7. Once you have created your custom ImageChat model, you can select your new model and begin testing. Select Test Model to upload one or more images for analysis.

Test Model Screen

8. View your results and fine-tune as needed by selecting Edit Model to adjust any additional parameters.

ImageChat Detection Example

Best practices for creating ImageChat prompts

Creating high-quality prompts for ImageChat is crucial to generating accurate results. Whether you are using the web interface or creating your own model integrated with an Object Detector, prompts must be free of typos and grammar errors, and should be straightforward to understand.

 

1. We recommend using prompts that are full sentences and end in a question mark.

Instead of: is there fire

Try: Is there fire or smoke in this image?

Instead of: do you see corrosion

Try: Is there corrosion in this image?

 

2. Refrain from creating run-on prompts. They can be confusing to ImageChat.

For instance: Is there fire or smoke or anything that might be dangerous in this image?

Instead, try multiple specific prompts such as: Is there fire or smoke in this image? and Is there dry brush in this image?

 

3. Finely tune your prompts for better the response accuracy. If you are not receiving the results you are expecting, try adjusting your prompts slightly and test again.

For instance, you can add the keyword “possible” to your prompt to allow a more sensitive detection from ImageChat.

Try: Is there possible rust in this image?

 

4. Add “in this image?to your prompts to help ImageChat understand your question better.

Instead of: Is there fire?

Try: Is there fire in this image?

If you have any questions on prompting or would like additional help from the Chooch Team, don’t hesitate to reach out at [email protected]

How to call the ImageChat API and functionality

Below we will describe the functionality of the ImageChat-3 API and expected results. There are 5 core component features of ImageChat-3 API that enable everything from image analysis to multi-language conversation.

See below:

Image prediction (prompting)

Image Prompting allows users to upload an image and interact with it using custom text prompts to receive AI-generated predictions regarding its content. ImageChat supports the following image formats: .jpg, .jpeg, and .png.

3 Circle Icon
  • Python
  • Javascript (REST)
  • cURL
Code Icon
Code Icon
# ImageChat-3 Predict Image

import requests
import json

# change host name as needed
host_name = "https://chat-api.chooch.ai"

def image_chat_predict(model_id, parameters, file_path = "", api_key = None):
 
    payload = {
      "parameters": parameters
    }
    
    parameters = {"parameters": parameters, "model_id": model_id}
    parameters_json =  json.dumps(parameters) 
    
    payload = {'data': parameters_json }

    url = "{}/predict?api_key={}".format(host_name, api_key)
    #-- url = "{}/predict_image_chat?api_key={}".format(host_name, api_key)
    if file_path == "":
         # normal post
         response = requests.post(url, data=payload)   
    else:
        # load file and post 
        file = {'file': open(file_path, 'rb')}
        response = requests.post(url, data=payload, files=file) 
        
    json_data = json.loads(response.content)
      
    return json_data 


# set parameters
parameters = {}

# Set prompt, pass prompt empty on first upload
prompt = "Describe this image in detail"
parameters["prompt"] = prompt


# optional lang 
# parameters["lang"] = "es"
# please see bottom of documentation for available languages

# optional maximum new tokens setting
#-- parameters["max_new_tokens"] = 512



# replace with your own Chooch api key. Get our Api Key by siging up to Chooch Vision Studio https://app.chooch.ai/
api_key = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx"


# make prediction
file_path = "files/recognize-man.jpg"


# set model_id
model_id = "chooch-image-chat-3"

return_val = image_chat_predict(model_id, parameters, file_path = file_path, api_key = api_key)


print(return_val)
Code Icon
async function imageChatPredict(modelId, parameters, filePath = "", apiKey = null) {
    const hostName = "https://chat-api.chooch.ai";
    
    const payload = {
        parameters: parameters
    };

    const parametersJson = JSON.stringify({ parameters, model_id: modelId });

    const formData = new FormData();
    formData.append('data', parametersJson);

    const url = `${hostName}/predict?api_key=${apiKey || ''}`;

    let response;
    if (filePath === "") {
        // Normal post
        response = await fetch(url, {
            method: 'POST',
            body: formData
        });
    } else {
        // Load file and post
        const file = document.querySelector('input[type=file]').files[0];
        formData.append('file', file);

        response = await fetch(url, {
            method: 'POST',
            body: formData
        });
    }

    const jsonData = await response.json();

    return jsonData;
}

// Set parameters
const parameters = {};

// Set prompt, pass an empty prompt on the first upload
const prompt = "Describe this image in detail";
parameters.prompt = prompt;

// Optional lang
// parameters.lang = "es";
// please see bottom of documentation for available languages

// Optional maximum new tokens setting
// parameters.max_new_tokens = 512;

// Replace with your own Chooch API key. Get our API Key by signing up for Chooch Vision Studio https://app.chooch.ai/
const apiKey = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx";

// Make prediction
const filePath = "files/recognize-man.jpg";

// Set modelId
const modelId = "chooch-image-chat-3";

imageChatPredict(modelId, parameters, filePath, apiKey)
    .then(returnVal => {
        console.log(returnVal);
    })
    .catch(error => {
        console.error(error);
    });
Code Icon
# ImageChat-3 Predict Image

host_name="https://chat-api.chooch.ai"
model_id="chooch-image-chat-3"
api_key="xxxxx-xxxx-xxxx-xxx-xxxxxxxx"
file_path="files/recognize-man.jpg"
prompt="Describe this image in detail"

parameters='{"prompt":"'$prompt'"}'

url="${host_name}/predict?api_key=${api_key}"

if [ -z "${file_path}" ]; then
    # normal post
    curl -X POST -H "Content-Type: application/json" -d "${parameters}" "${url}"
else
    # load file and post
    curl -X POST -H "Content-Type: application/json" -F "file=@${file_path}" -F "data=${parameters}" "${url}"
fi
Sample Response
3 Circle Icon Code Icon
Code Icon
{
   "model_title":"Chooch-ImageChat-3",
   "model_id":"Chooch-ImageChat-3",
   "prediction":"The image depicts a man lying on the floor in a warehouse, surrounded by various objects and equipment. He is wearing a safety vest and a hard hat, indicating that he is working in a potentially hazardous environment. The man is holding his head in his hands, suggesting that he may be experiencing some discomfort or pain. There are several large boxes and shelves in the background, which could indicate that the man is working in a warehouse or storage facility. Overall, the image conveys a sense of caution and attention to safety in the workplace.",
   "prediction_type":"Chooch-ImageChat-3-Image",
   "prompt":"Describe this image in detail",
   "source_id":"fc5de4b2-896b-4567-afe7-324376a49c3c.jpg",
   "source_type":"image",
   "status":"Successful Prediction"
}
Predict with source_id, continue chat/conversation on source:
3 Circle Icon
  • Python
  • Javascript (REST)
  • cURL
Code Icon
Code Icon
# predict with source_id, continue chat/conversation on source.

import requests
import json

# change host name as needed
host_name = "https://chat-api.chooch.ai"

def image_chat_predict(model_id, parameters, file_path = "", api_key = None):
 
    payload = {
      "parameters": parameters
    }
    
    parameters = {"parameters": parameters, "model_id": model_id}
    parameters_json =  json.dumps(parameters) 
    
    payload = {'data': parameters_json }

    url = "{}/predict?api_key={}".format(host_name, api_key)
    #-- url = "{}/predict_image_chat?api_key={}".format(host_name, api_key)
    if file_path == "":
         # normal post
         response = requests.post(url, data=payload)   
    else:
        # load file and post 
        file = {'file': open(file_path, 'rb')}
        response = requests.post(url, data=payload, files=file) 
        
    json_data = json.loads(response.content)
      
    return json_data 



# set parameters
parameters = {}

# Set prompt, pass prompt empty on first upload
prompt = "Describe this image in detail" 
parameters["prompt"] = prompt
parameters["source_id"] = "e7533423-2764-433c-8d48-b3c37d17dd0b.jpg"

# optional lang 
# parameters["lang"] = "es"
# please see bottom of documentation for available languages

# optional maximum new tokens setting
#-- parameters["max_new_tokens"] = 512


# replace with your own Chooch api key. Get our Api Key by siging up to Chooch Vision Studio https://app.chooch.ai/
api_key = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx"


file_path = ""


# set model_id
model_id = "chooch-image-chat-3"

return_val = image_chat_predict(model_id, parameters, file_path = file_path, api_key = api_key)


print(return_val)
Code Icon
async function imageChatPredict(modelId, parameters, filePath = "", apiKey = null) {
    const hostName = "https://chat-api.chooch.ai";
    const url = `${hostName}/predict?api_key=${apiKey || ""}`;

    const requestData = {
        parameters: parameters,
        model_id: modelId,
    };

    const formData = new FormData();
    formData.append("data", JSON.stringify(requestData));

    let response;
    if (filePath === "") {
        // normal post
        response = await fetch(url, {
            method: "POST",
            body: formData,
        });
    } else {
        // load file and post
        const file = document.querySelector('input[type="file"]').files[0];
        formData.append("file", file);

        response = await fetch(url, {
            method: "POST",
            body: formData,
        });
    }

    const jsonData = await response.json();

    return jsonData;
}

// set parameters
const parameters = {};

// Set prompt, pass prompt empty on first upload
const prompt = "Describe this image in detail";
parameters.prompt = prompt;
parameters.source_id = "e7533423-2764-433c-8d48-b3c37d17dd0b.jpg";

// optional lang
// parameters.lang = "es";
// please see bottom of documentation for available languages

// optional maximum new tokens setting
// parameters.max_new_tokens = 512;

// replace with your own Chooch api key. Get our Api Key by signing up to Chooch Vision Studio https://app.chooch.ai/
const apiKey = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx";

const filePath = "";

// set model_id
const modelId = "chooch-image-chat-3";

imageChatPredict(modelId, parameters, filePath, apiKey)
    .then((returnVal) => {
        console.log(returnVal);
    })
    .catch((error) => {
        console.error(error);
    });
Code Icon
# set parameters
prompt="Describe this image in detail"
source_id="e7533423-2764-433c-8d48-b3c37d17dd0b.jpg"
api_key="xxxxx-xxxx-xxxx-xxx-xxxxxxxx"
model_id="chooch-image-chat-3"

# optional lang
# lang="es"

# optional maximum new tokens setting
# max_new_tokens=512

# replace with your own Chooch api key. Get our Api Key by signing up to Chooch Vision Studio https://app.chooch.ai/

# create JSON data
json_data=$(cat <<EOF
{
  "parameters": {
    "prompt": "$prompt",
    "source_id": "$source_id"
    # Add other parameters as needed
  },
  "model_id": "$model_id"
}
EOF
)

# URL encode the JSON data
json_data_escaped=$(echo $json_data | jq -c -r @uri)

# make the cURL request
if [ -z "$file_path" ]; then
  # normal post
  curl -X POST "$host_name/predict?api_key=$api_key" -H "Content-Type: application/json" -d "$json_data_escaped"
else
  # load file and post
  curl -X POST "$host_name/predict?api_key=$api_key" -H "Content-Type: application/json" -d "$json_data_escaped" -F "file=@$file_path"
fi

Sample Response

3 Circle Icon Code Icon
Code Icon
{
   "model_title":"Chooch-ImageChat-3",
   "model_id":"Chooch-ImageChat-3",
   "prediction":"The image shows a man lying on the floor in a warehouse or storage facility, surrounded by various objects and equipment. He is wearing a safety vest, which suggests that he may have been working in a potentially hazardous environment. The man appears to be injured or in distress, as he is holding his head in his hands and appears to be crying. There are several shelves and pallets visible in the background, which further supports the idea that the man was working in a warehouse or storage facility.\n\nThe exact nature of the man's injury or distress is not clear from the image, but it appears to be a serious situation that requires immediate attention. It is possible that he may have been involved in an accident or injury while working, or he may be experiencing emotional distress due to a personal or work-related issue. Regardless of the cause, it is important that the man receives proper medical attention and support to address his injuries or emotional challenges.",
   "prediction_type":"Chooch-ImageChat-3-Image",
   "prompt":"Describe this image in detail",
   "source_id":"e7533423-2764-433c-8d48-b3c37d17dd0b.jpg",
   "source_type":"image",
   "status":"Successful Prediction"
}
Predict with source_id:
3 Circle Icon
  • Python
  • Javascript (REST)
  • cURL
Code Icon
Code Icon
# predict with source_id

import requests
import json

# change host name as needed
host_name = "https://chat-api.chooch.ai"

def image_chat_predict(model_id, parameters, file_path = "", api_key = None):
 
    payload = {
      "parameters": parameters
    }
    
    parameters = {"parameters": parameters, "model_id": model_id}
    parameters_json =  json.dumps(parameters) 
    
    payload = {'data': parameters_json }

    url = "{}/predict?api_key={}".format(host_name, api_key)
    #-- url = "{}/predict_image_chat?api_key={}".format(host_name, api_key)
    if file_path == "":
         # normal post
         response = requests.post(url, data=payload)   
    else:
        # load file and post 
        file = {'file': open(file_path, 'rb')}
        response = requests.post(url, data=payload, files=file) 
        
    json_data = json.loads(response.content)
      
    return json_data 



# set parameters
parameters = {}

# Set prommpt, pass prompt empty on first upload
prompt = "Describe this image in detail" 
parameters["prompt"] = prompt
parameters["source"] = "https://chooch-share.s3.amazonaws.com/recognize-man.jpg"

# optional lang 
# parameters["lang"] = "es"
# please see bottom of documentation for available languages


# optional maximum new tokens setting
#-- parameters["max_new_tokens"] = 512



# replace with your own Chooch api key. Get our Api Key by siging up to Chooch Vision Studio https://app.chooch.ai/
api_key = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx"

file_path = ""


# set model_id
model_id = "chooch-image-chat-3"

return_val = image_chat_predict(model_id, parameters, file_path = file_path, api_key = api_key)


print(return_val)
Code Icon
async function imageChatPredict(modelId, parameters, filePath = "", apiKey = null) {
    const hostName = "https://chat-api.chooch.ai";
    const url = `${hostName}/predict?api_key=${apiKey || ''}`;

    const payload = {
        parameters: parameters
    };

    const formData = new FormData();
    formData.append('data', JSON.stringify(payload));

    if (filePath !== "") {
        const file = document.querySelector('input[type="file"]').files[0];
        formData.append('file', file);
    }

    try {
        const response = await fetch(url, {
            method: 'POST',
            body: formData
        });

        const jsonData = await response.json();
        return jsonData;
    } catch (error) {
        console.error('Error:', error);
    }
}

// Set parameters
const parameters = {};

// Set prompt, pass prompt empty on first upload
const prompt = "Describe this image in detail";
parameters.prompt = prompt;
parameters.source = "https://chooch-share.s3.amazonaws.com/recognize-man.jpg";

// Optional lang
// parameters.lang = "es";
// please see bottom of documentation for available languages

// Optional maximum new tokens setting
// parameters.max_new_tokens = 512;

// Replace with your own Chooch API key. Get our API Key by signing up to Chooch Vision Studio https://app.chooch.ai/
const apiKey = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx";

const filePath = "";

// Set model_id
const modelId = "chooch-image-chat-3";

imageChatPredict(modelId, parameters, filePath, apiKey)
    .then(returnVal => console.log(returnVal))
    .catch(error => console.error('Error:', error));
Code Icon
# predict with source_id

# set parameters
PROMPT="Describe this image in detail"
SOURCE="https://chooch-share.s3.amazonaws.com/recognize-man.jpg"
MODEL_ID="chooch-image-chat-3"
API_KEY="xxxxx-xxxx-xxxx-xxx-xxxxxxxx"

# optional lang
# LANG="es"

# optional maximum new tokens setting
# MAX_NEW_TOKENS=512

# convert parameters to JSON
PARAMETERS_JSON=$(echo '{"prompt": "'"${PROMPT}"'", "source": "'"${SOURCE}"'"}')

# set host name
HOST_NAME="https://chat-api.chooch.ai"

# construct cURL command
if [ -z "$file_path" ]; then
  # normal post
  curl -X POST -H "Content-Type: application/json" -d '{"parameters": '"${PARAMETERS_JSON}"', "model_id": "'"${MODEL_ID}"'"}' "${HOST_NAME}/predict?api_key=${API_KEY}"
else
  # load file and post
  curl -X POST -H "Content-Type: application/json" -d '{"parameters": '"${PARAMETERS_JSON}"', "model_id": "'"${MODEL_ID}"'"}' -F "file=@${file_path}" "${HOST_NAME}/predict?api_key=${API_KEY}"
fi
Sample Response
3 Circle Icon Code Icon
Code Icon
{
   "model_title":"Chooch-ImageChat-3",
   "model_id":"Chooch-ImageChat-3",
   "prediction":"The image depicts a man lying on the floor in a warehouse, surrounded by various objects and equipment. He is wearing a safety vest and appears to be injured or in distress. There is a ladder nearby, but it is not clear if it is the cause of the man's injury or if it is just a part of the scene.",
   "prediction_type":"Chooch-ImageChat-3-Image",
   "prompt":"Describe this image in detail",
   "source_id":"3391604b-1722-426a-be54-94651f4cf9dd.jpg",
   "source_type":"image",
   "status":"Successful Prediction"
}

Workflow prediction

The Workflow Prediction offers an advanced fusion of object detection models with ImageChat capabilities. Users have the flexibility to combine ImageChat foundational model with Chooch’s ReadyNow Models or even integrate your own Custom Object Detection models for more detailed and custom results.

For instance, you can create a workflow by writing the prompt, “is there any person with a backpack?” followed by integrating General Object Detection 4.0 (80) model with the “person” class. The model will first identify the “person” and then the prompt questions will directly query  the identified person by the Object Detection model.

3 Circle Icon
  • Python
  • Javascript (REST)
  • cURL
Code Icon
Code Icon
# ImageChat-3 Predict Image Workflow

import requests
import json

# change hostname endpoint as needed
host_name = "https://chat-api.chooch.ai"

def image_chat_predict(model_id, parameters, file_path = "", api_key = None):
 
    payload = {
      "parameters": parameters
    }
    
    parameters = {"parameters": parameters, "model_id": model_id}
    parameters_json =  json.dumps(parameters) 
    
    payload = {'data': parameters_json }

    url = "{}/predict?api_key={}".format(host_name, api_key)
    #-- url = "{}/predict_image_chat?api_key={}".format(host_name, api_key)
    if file_path == "":
         # normal post
         response = requests.post(url, data=payload)   
    else:
        # load file and post 
        file = {'file': open(file_path, 'rb')}
        response = requests.post(url, data=payload, files=file) 
        
    json_data = json.loads(response.content)
      
    return json_data 


# set parameters
parameters = {}

# Set prommpt, pass prompt empty on first upload
prompt = "is there smoke in this image?"
parameters["prompt"] = prompt




# workflow parameters
smoke_fire_object_detection_model_id  = "c9541d50-8391-43c5-ae33-ce32a5c116e0"

parameters["workflow_model_id"]  = smoke_fire_object_detection_model_id 
# Optional predict_objects_only field. When set to True IC2-PT to run on objects only, disregards the image. Default value is False 
parameters["workflow_predict_objects_only"] = True
# Optional workflow_class_filter field. This property is sets the object detector class filter. Default values empty string which means all object detection
# classes will run
parameters["workflow_class_filter"]  = ""
# Optional workflow_padding field.  Padding percentage that will be put left and right on the object cutout. Default value is None 
parameters["workflow_padding"]  = 0.6



# replace with your own Chooch api key. Get our Api Key by siging up to Chooch Vision Studio https://app.chooch.ai/
api_key = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx"

# make prediction
file_path = "files/smoke_test.jpg"


# set model_id
model_id = "chooch-image-chat-3"

return_val = image_chat_predict(model_id, parameters, file_path = file_path, api_key = api_key)


print(return_val)
Code Icon
async function imageChatPredict(modelId, parameters, filePath = "", apiKey = null) {
    const hostName = "https://chat-api.chooch.ai";
    
    const data = {
        parameters: parameters,
        model_id: modelId
    };
    
    const payload = {
        method: "POST",
        headers: {
            "Content-Type": "application/json",
        },
        body: JSON.stringify(data),
    };

    const url = `${hostName}/predict?api_key=${apiKey || ""}`;

    if (filePath !== "") {
        // If file path is provided, include the file in the request
        const formData = new FormData();
        formData.append("data", JSON.stringify(data));
        formData.append("file", await fetch(filePath).then((res) => res.blob()), "image.jpg");

        payload.body = formData;
    }

    const response = await fetch(url, payload);
    const jsonData = await response.json();

    return jsonData;
}

// Set parameters
const parameters = {};

// Set prompt, pass an empty prompt on the first upload
const prompt = "is there smoke in this image?";
parameters["prompt"] = prompt;

// Workflow parameters
const smokeFireObjectDetectionModelId = "c9541d50-8391-43c5-ae33-ce32a5c116e0";
parameters["workflow_model_id"] = smokeFireObjectDetectionModelId;
parameters["workflow_predict_objects_only"] = true;
parameters["workflow_class_filter"] = "";
parameters["workflow_padding"] = 0.6;

// Replace with your own Chooch API key. Get your API Key by signing up for Chooch Vision Studio: https://app.chooch.ai/
const apiKey = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx";

// Make prediction
const filePath = "files/smoke_test.jpg";

// Set modelId
const modelId = "chooch-image-chat-3";

imageChatPredict(modelId, parameters, filePath, apiKey)
    .then(returnVal => console.log(returnVal))
    .catch(error => console.error(error));
Code Icon
# ImageChat-3 Predict Image Workflow

# change hostname endpoint as needed
host_name="https://chat-api.chooch.ai"

# set parameters
parameters='{"prompt": "is there smoke in this image?", "workflow_model_id": "c9541d50-8391-43c5-ae33-ce32a5c116e0", "workflow_predict_objects_only": true, "workflow_class_filter": "", "workflow_padding": 0.6}'

# replace with your own Chooch api key. Get our Api Key by signing up to Chooch Vision Studio https://app.chooch.ai/
api_key="xxxxx-xxxx-xxxx-xxx-xxxxxxxx"

# make prediction
file_path="files/smoke_test.jpg"

# set model_id
model_id="chooch-image-chat-3"

# cURL command for image prediction
curl_command="curl -X POST -H 'Content-Type: application/json' -H 'Api-Key: {}' -d '{}' {}/predict_image_chat".format(api_key, parameters, host_name)

if [ -n "$file_path" ]; then
  # if file_path is not empty, include file upload in the cURL command
  curl_command="${curl_command} -F 'file=@{}'".format(file_path)
fi

# execute the cURL command
response=$(eval $curl_command)

# print the response
echo $response

Sample Response

3 Circle Icon Code Icon
Code Icon
{
   "model_title":"Chooch-ImageChat-3",
   "model_id":"Chooch-ImageChat-3",
   "prediction":[
      {
         "class_title":"Yes, there is smoke in the image.",
         "score":0.599,
         "prompt":"is there smoke in this image?",
         "model_id":"chooch-imagechat-3",
         "model_title":"Chooch-ImageChat-3",
         "coordinates":{
            "xmin":0,
            "ymin":195,
            "xmax":269,
            "ymax":380
         }
      }
   ],
   "prediction_type":"Chooch-ImageChat-3-Workflow",
   "prompt":"is there smoke in this image?",
   "source_id":"9067d0f8-0bf1-432a-80ee-d22478b9d6ee.jpg",
   "source_type":"image",
   "status":"Successful Prediction"
}
Predict with source_id, continue chat/conversation on source:
3 Circle Icon
  • Python
  • Javascript (REST)
  • cURL
Code Icon
Code Icon
# predict with source_id, continue chat/conversation on source.

import requests
import json

# change hostname endpoint as needed
host_name = "https://chat-api.chooch.ai"

def image_chat_predict(model_id, parameters, file_path = "", api_key = None):
 
    payload = {
      "parameters": parameters
    }
    
    parameters = {"parameters": parameters, "model_id": model_id}
    parameters_json =  json.dumps(parameters) 
    
    payload = {'data': parameters_json }

    url = "{}/predict?api_key={}".format(host_name, api_key)
    #-- url = "{}/predict_image_chat?api_key={}".format(host_name, api_key)
    if file_path == "":
         # normal post
         response = requests.post(url, data=payload)   
    else:
        # load file and post 
        file = {'file': open(file_path, 'rb')}
        response = requests.post(url, data=payload, files=file) 
        
    json_data = json.loads(response.content)
      
    return json_data 



# set parameters
parameters = {}

# Set prommpt, pass prompt empty on first upload
prompt = "is there smoke in this image?"
parameters["prompt"] = prompt
parameters["source_id"] = "9067d0f8-0bf1-432a-80ee-d22478b9d6ee.jpg"


# workflow parameters
smoke_fire_object_detection_model_id  = "c9541d50-8391-43c5-ae33-ce32a5c116e0"

parameters["workflow_model_id"]  = smoke_fire_object_detection_model_id 
# Optional predict_objects_only field. When set to True IC2-PT to run on objects only, disregards the image. Default value is False 
parameters["workflow_predict_objects_only"] = True
# Optional workflow_class_filter field. This property is sets the object detector class filter. Default values empty string which means all object detection
# classes will run
parameters["workflow_class_filter"]  = ""
# Optional workflow_padding field.  Padding percentage that will be put left and right on the object cutout. Default value is None 
parameters["workflow_padding"]  = 0.6



# replace with your own Chooch api key. Get our Api Key by siging up to Chooch Vision Studio https://app.chooch.ai/
api_key = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx"

file_path = ""


# set model_id
model_id = "chooch-image-chat-3"

return_val = image_chat_predict(model_id, parameters, file_path = file_path, api_key = api_key)


print(return_val)
Code Icon
async function imageChatPredict(modelId, parameters, filePath = "", apiKey = null) {
  const hostName = "https://chat-api.chooch.ai";
  const prompt = "is there smoke in this image?";

  const payload = {
    parameters: parameters,
  };

  const parametersData = {
    parameters: parameters,
    model_id: modelId,
  };

  const parametersJson = JSON.stringify(parametersData);

  const data = { data: parametersJson };

  const url = `${hostName}/predict?api_key=${apiKey || ""}`;

  let response;

  if (filePath === "") {
    response = await fetch(url, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify(data),
    });
  } else {
    const formData = new FormData();
    formData.append("file", await fetch(filePath).then((r) => r.blob()));

    response = await fetch(url, {
      method: "POST",
      headers: {
        // "Content-Type": "multipart/form-data", // No need to set Content-Type for FormData
      },
      body: formData,
    });
  }

  const jsonData = await response.json();

  return jsonData;
}

// Set parameters
const parameters = {};

// Set prompt, pass prompt empty on the first upload
parameters.prompt = "is there smoke in this image?";
parameters.source_id = "9067d0f8-0bf1-432a-80ee-d22478b9d6ee.jpg";

// Workflow parameters
const smokeFireObjectDetectionModelId =
  "c9541d50-8391-43c5-ae33-ce32a5c116e0";

parameters.workflow_model_id = smokeFireObjectDetectionModelId;
// Optional predict_objects_only field. When set to True IC2-PT to run on objects only, disregards the image. Default value is False
parameters.workflow_predict_objects_only = true;
// Optional workflow_class_filter field. This property is set to the object detector class filter. Default values an empty string which means all object detection
// classes will run
parameters.workflow_class_filter = "";
// Optional workflow_padding field. Padding percentage that will be put left and right on the object cutout. Default value is None
parameters.workflow_padding = 0.6;

// Replace with your own Chooch API key. Get our API Key by signing up for Chooch Vision Studio https://app.chooch.ai/
const apiKey = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx";

const filePath = "";

// Set model_id
const modelId = "chooch-image-chat-3";

imageChatPredict(modelId, parameters, filePath, apiKey)
  .then((returnValue) => console.log(returnValue))
  .catch((error) => console.error(error));
Code Icon
# set parameters
prompt="is there smoke in this image?"
source_id="9067d0f8-0bf1-432a-80ee-d22478b9d6ee.jpg"
workflow_model_id="c9541d50-8391-43c5-ae33-ce32a5c116e0"
workflow_predict_objects_only=true
workflow_class_filter=""
workflow_padding=0.6

# replace with your own Chooch api key
api_key="xxxxx-xxxx-xxxx-xxx-xxxxxxxx"

# set model_id
model_id="chooch-image-chat-3"

# prepare data for POST request
data='{"parameters": {"prompt": "%s", "source_id": "%s", "workflow_model_id": "%s", "workflow_predict_objects_only": %s, "workflow_class_filter": "%s", "workflow_padding": %s}}' % (prompt, source_id, workflow_model_id, str(workflow_predict_objects_only).lower(), workflow_class_filter, str(workflow_padding))

# prepare cURL command
curl_command="curl -X POST -H 'Content-Type: application/json' -d '%s' '%s/predict?api_key=%s'" % (data, "https://chat-api.chooch.ai", api_key)

# execute cURL command
response=$(eval $curl_command)

# print response
echo $response

Sample Response

3 Circle Icon Code Icon
Code Icon
{
   "model_title":"Chooch-ImageChat-3",
   "model_id":"Chooch-ImageChat-3",
   "prediction":[
      {
         "class_title":"The image depicts a mountainous landscape with a large fire burning in the distance. The mountains are covered in brown and green vegetation, and the fire appears to be burning in a valley between the peaks. The sky is clear and blue, with a few white clouds scattered across it. The image appears to be taken from a high vantage point, as the viewer can see the entire mountain range and the fire burning in the distance.",
         "score":0.599,
         "prompt":"Describe this image in detail",
         "model_id":"chooch-imagechat-3",
         "model_title":"Chooch-ImageChat-3",
         "coordinates":{
            "xmin":0,
            "ymin":195,
            "xmax":269,
            "ymax":380
         }
      }
   ],
   "prediction_type":"Chooch-ImageChat-3-Workflow",
   "prompt":"Describe this image in detail",
   "source_id":"9067d0f8-0bf1-432a-80ee-d22478b9d6ee.jpg",
   "source_type":"image",
   "status":"Successful Prediction"
}
Predict with file URL
3 Circle Icon
  • Python
  • Javascript (REST)
  • cURL
Code Icon
Code Icon
# predict with file url

import requests
import json

# change hostname endpoint as needed
host_name = "https://chat-api.chooch.ai"

def image_chat_predict(model_id, parameters, file_path = "", api_key = None):
 
    payload = {
      "parameters": parameters
    }
    
    parameters = {"parameters": parameters, "model_id": model_id}
    parameters_json =  json.dumps(parameters) 
    
    payload = {'data': parameters_json }

    url = "{}/predict?api_key={}".format(host_name, api_key)
    #-- url = "{}/predict_image_chat?api_key={}".format(host_name, api_key)
    if file_path == "":
         # normal post
         response = requests.post(url, data=payload)   
    else:
        # load file and post 
        file = {'file': open(file_path, 'rb')}
        response = requests.post(url, data=payload, files=file) 
        
    json_data = json.loads(response.content)
      
    return json_data 



# set parameters
parameters = {}

# Set prommpt, pass prompt empty on first upload
prompt = "is there smoke in this image?"
parameters["prompt"] = prompt
parameters["source"] = "https://chooch-share.s3.amazonaws.com/smoke_test.jpg"

# replace with your own Chooch api key. Get our Api Key by siging up to Chooch Vision Studio https://app.chooch.ai/
api_key = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx"

file_path = ""


# set model_id
model_id = "chooch-image-chat-3"

return_val = image_chat_predict(model_id, parameters, file_path = file_path, api_key = api_key)


print(return_val)
Code Icon
async function imageChatPredict(modelId, parameters, filePath = "", apiKey = null) {
  const hostName = "https://chat-api.chooch.ai";
  const url = `${hostName}/predict?api_key=${apiKey || ""}`;

  const formData = new FormData();
  formData.append("parameters", JSON.stringify(parameters));
  formData.append("model_id", modelId);

  if (filePath !== "") {
    const file = await fetch(filePath).then(response => response.blob());
    formData.append("file", file, "image.jpg");
  }

  const response = await fetch(url, {
    method: "POST",
    body: formData
  });

  const jsonData = await response.json();
  return jsonData;
}

// Set parameters
const parameters = {};

// Set prompt, pass an empty prompt on the first upload
const prompt = "Is there smoke in this image?";
parameters["prompt"] = prompt;
parameters["source"] =
  "https://chooch-share.s3.amazonaws.com/smoke_test.jpg";

// Replace with your own Chooch API key. Get your API key by signing up for Chooch Vision Studio: https://app.chooch.ai/
const apiKey = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx";

const filePath = "";

// Set model_id
const modelId = "chooch-image-chat-3";

// Call the function and log the return value
imageChatPredict(modelId, parameters, filePath, apiKey)
  .then(returnVal => console.log(returnVal))
  .catch(error => console.error(error));
Code Icon
# predict with file url

# set parameters
prompt="is there smoke in this image?"
source="https://chooch-share.s3.amazonaws.com/smoke_test.jpg"
api_key="xxxxx-xxxx-xxxx-xxx-xxxxxxxx"
model_id="chooch-image-chat-3"

# change hostname endpoint as needed
host_name="https://chat-api.chooch.ai"

# create JSON payload
parameters='{"prompt": "'$prompt'", "source": "'$source'"}'
payload='{"parameters": '$parameters', "model_id": "'$model_id'"}'

# perform the cURL request
if [ -z "$file_path" ]; then
    # normal post
    curl -X POST -H "Content-Type: application/json" -d "$payload" "$host_name/predict?api_key=$api_key"
else
    # load file and post
    curl -X POST -H "Content-Type: application/json" -F "file=@$file_path" -d "$payload" "$host_name/predict?api_key=$api_key"
fi

Sample Response

3 Circle Icon Code Icon
Code Icon
{
   "model_title":"Chooch-ImageChat-3",
   "model_id":"Chooch-ImageChat-3",
   "prediction":"Yes, there is smoke in the image.",
   "prediction_type":"Chooch-ImageChat-3-Image",
   "prompt":"is there smoke in this image?",
   "source_id":"eb1f8077-3843-4367-aa20-80562d0f71ad.jpg",
   "source_type":"image",
   "status":"Successful Prediction"
}

Vision prediction

This section provides a standalone API designed for those who have existing custom object detection models or are utilizing Chooch ReadyNow models. It serves as a dedicated platform to execute and analyze predictions derived from these models.

3 Circle Icon
  • Python
  • Javascript (REST)
  • cURL
Code Icon
Code Icon
# Predict Image Chooch Vision

import requests
import json

# change hostname endpoint as needed
host_name = "https://chat-api.chooch.ai"


def image_chat_predict(model_id, parameters, file_path = "", api_key = None):
 
    payload = {
      "parameters": parameters
    }
    
    parameters = {"parameters": parameters, "model_id": model_id}
    parameters_json =  json.dumps(parameters) 
    
    payload = {'data': parameters_json }

    url = "{}/predict?api_key={}".format(host_name, api_key)
    #-- url = "{}/predict_image_chat?api_key={}".format(host_name, api_key)
    if file_path == "":
         # normal post
         response = requests.post(url, data=payload)   
    else:
        # load file and post 
        file = {'file': open(file_path, 'rb')}
        response = requests.post(url, data=payload, files=file) 
        
    json_data = json.loads(response.content)
      
    return json_data 


# set parameters
parameters = {}




# replace with your own Chooch api key. Get our Api Key by siging up to Chooch Vision Studio https://app.chooch.ai/
api_key = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx"


# make prediction
file_path = "files/smoke_test.jpg"


smoke_fire_object_detection_model_id  = "c9541d50-8391-43c5-ae33-ce32a5c116e0"

# set model_id
model_id = smoke_fire_object_detection_model_id

return_val = image_chat_predict(model_id, parameters, file_path = file_path, api_key = api_key)

Code Icon
async function imageChatPredict(modelId, parameters, filePath = "", apiKey = null) {
    const hostName = "https://chat-api.chooch.ai";
    
    const data = {
        parameters: parameters,
        model_id: modelId
    };

    const payload = {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'api_key': apiKey
        },
        body: JSON.stringify(data)
    };

    const url = `${hostName}/predict`;

    if (filePath === "") {
        // Normal post
        const response = await fetch(url, payload);
        const jsonData = await response.json();
        return jsonData;
    } else {
        // Load file and post
        const formData = new FormData();
        formData.append('file', await fetch(filePath).then(response => response.blob()), 'image.jpg');
        formData.append('data', JSON.stringify(data));

        const filePayload = {
            method: 'POST',
            body: formData
        };

        const response = await fetch(url, filePayload);
        const jsonData = await response.json();
        return jsonData;
    }
}

// Set parameters
const parameters = {};

// Replace with your own Chooch API key.
const apiKey = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx";

// Make prediction
const filePath = "files/smoke_test.jpg";

const smokeFireObjectDetectionModelId = "c9541d50-8391-43c5-ae33-ce32a5c116e0";

// Set modelId
const modelId = smokeFireObjectDetectionModelId;

// Example usage
imageChatPredict(modelId, parameters, filePath, apiKey)
    .then(returnVal => console.log(returnVal))
    .catch(error => console.error(error));
Code Icon
# set parameters
parameters='{}'

# replace with your own Chooch api key. Get our Api Key by siging up to Chooch Vision Studio https://app.chooch.ai/
api_key="xxxxx-xxxx-xxxx-xxx-xxxxxxxx"

# make prediction
file_path="files/smoke_test.jpg"

smoke_fire_object_detection_model_id="c9541d50-8391-43c5-ae33-ce32a5c116e0"

# set model_id
model_id=$smoke_fire_object_detection_model_id

# construct the cURL command
curl_command="curl -X POST -H 'Content-Type: application/json' -H 'cache-control: no-cache' -H 'api_key: $api_key' -d '{\"parameters\": $parameters, \"model_id\": \"$model_id\"}' $host_name/predict"

# if file_path is not empty, add the file to the cURL command
if [ -n "$file_path" ]; then
    curl_command="$curl_command -F file=@$file_path"
fi

# execute the cURL command
response=$(eval $curl_command)

# print the response
echo $response

Sample Response

3 Circle Icon Code Icon
Code Icon
{
   "model_title":"c9541d50-8391-43c5-ae33-ce32a5c116e0",
   "model_id":"c9541d50-8391-43c5-ae33-ce32a5c116e0",
   "prediction":[
      {
         "class_title":"smoke",
         "score":0.599,
         "model_id":"c9541d50-8391-43c5-ae33-ce32a5c116e0",
         "model_title":"c9541d50-8391-43c5-ae33-ce32a5c116e0",
         "coordinates":{
            "xmin":1,
            "ymin":246,
            "xmax":169,
            "ymax":330
         }
      }
   ],
   "prediction_type":"Chooch-Vision-Model",
   "source_id":"bcce8276-9c0c-40b5-8cff-d36dadd91e35.jpg",
   "source_type":"image",
   "status":"Successful Prediction"
}
Predict with file URL:
3 Circle Icon
  • Python
  • Javascript (REST)
  • cURL
Code Icon
Code Icon
# predict with file url

import requests
import json

# change hostname endpoint as needed
host_name = "https://chat-api.chooch.ai"

def image_chat_predict(model_id, parameters, file_path = "", api_key = None):
 
    payload = {
      "parameters": parameters
    }
    
    parameters = {"parameters": parameters, "model_id": model_id}
    parameters_json =  json.dumps(parameters) 
    
    payload = {'data': parameters_json }

    url = "{}/predict?api_key={}".format(host_name, api_key)
    #-- url = "{}/predict_image_chat?api_key={}".format(host_name, api_key)
    if file_path == "":
         # normal post
         response = requests.post(url, data=payload)   
    else:
        # load file and post 
        file = {'file': open(file_path, 'rb')}
        response = requests.post(url, data=payload, files=file) 
        
    json_data = json.loads(response.content)
      
    return json_data 




parameters["source"] = "https://chooch-share.s3.amazonaws.com/smoke_test.jpg"

# replace with your own Chooch api key. Get our Api Key by siging up to Chooch Vision Studio https://app.chooch.ai/
api_key = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx"


file_path = ""

smoke_fire_object_detection_model_id  = "c9541d50-8391-43c5-ae33-ce32a5c116e0"

# set model_id
model_id = smoke_fire_object_detection_model_id


return_val = image_chat_predict(model_id, parameters, file_path = file_path, api_key = api_key)


print(return_val)
Code Icon
async function imageChatPredict(modelId, parameters, filePath = "", apiKey = null) {
  const hostName = "https://chat-api.chooch.ai";
  
  const payload = {
    parameters: parameters,
  };

  const parametersJson = JSON.stringify({ parameters, modelId });
  const formData = new FormData();
  formData.append("data", parametersJson);

  const url = `${hostName}/predict?api_key=${apiKey || ""}`;

  let response;
  if (filePath === "") {
    // Normal post
    response = await fetch(url, {
      method: "POST",
      body: formData,
    });
  } else {
    // Load file and post
    const file = document.querySelector('input[type="file"]').files[0];
    formData.append("file", file);
    
    response = await fetch(url, {
      method: "POST",
      body: formData,
    });
  }

  const jsonData = await response.json();
  return jsonData;
}

// Örnek kullanım
const parameters = { source: "https://chooch-share.s3.amazonaws.com/smoke_test.jpg" };
const apiKey = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx";
const filePath = "";
const smokeFireObjectDetectionModelId = "c9541d50-8391-43c5-ae33-ce32a5c116e0";
const modelId = smokeFireObjectDetectionModelId;

imageChatPredict(modelId, parameters, filePath, apiKey)
  .then(returnVal => console.log(returnVal))
  .catch(error => console.error(error));
Code Icon
# predict with file url

# replace with your own Chooch api key. Get our Api Key by siging up to Chooch Vision Studio https://app.chooch.ai/
api_key="xxxxx-xxxx-xxxx-xxx-xxxxxxxx"

model_id="c9541d50-8391-43c5-ae33-ce32a5c116e0"
file_path=""
source_url="https://chooch-share.s3.amazonaws.com/smoke_test.jpg"

host_name="https://chat-api.chooch.ai"

# build parameters
parameters='{"source":"'${source_url}'"}'

# build cURL command
curl_command="curl -X POST -H 'Content-Type: application/json' -d '{\"parameters\": ${parameters}, \"model_id\": \"${model_id}\"}'"

# add file path if provided
if [ -n "${file_path}" ]; then
    curl_command="${curl_command} -F file=@${file_path}"
fi

# add API key if provided
if [ -n "${api_key}" ]; then
    curl_command="${curl_command} '${host_name}/predict?api_key=${api_key}'"
else
    curl_command="${curl_command} '${host_name}/predict'"
fi

# execute cURL command
eval ${curl_command}

Sample Response

3 Circle Icon Code Icon
Code Icon
{
   "model_title":"c9541d50-8391-43c5-ae33-ce32a5c116e0",
   "model_id":"c9541d50-8391-43c5-ae33-ce32a5c116e0",
   "prediction":[
      {
         "class_title":"smoke",
         "score":0.599,
         "model_id":"c9541d50-8391-43c5-ae33-ce32a5c116e0",
         "model_title":"c9541d50-8391-43c5-ae33-ce32a5c116e0",
         "coordinates":{
            "xmin":1,
            "ymin":246,
            "xmax":169,
            "ymax":330
         }
      }
   ],
   "prediction_type":"Chooch-Vision-Model",
   "source_id":"c7a4a350-e288-41af-b664-8ef6501930d7.jpg",
   "source_type":"image",
   "status":"Successful Prediction"
}

Text prediction (prompting)

Text Prediction is designed for users who want to initiate a dialogue directly with the AI without the need for an image. Simply input your text, and the AI will generate a response, facilitating a seamless conversational experience.

3 Circle Icon
  • Python
  • Javascript (REST)
  • cURL
Code Icon
Code Icon
# ImageChat-3 Predict Text

import requests
import json

# change hostname endpoint as needed
host_name = "https://chat-api.chooch.ai"

def image_chat_predict(model_id, parameters, file_path = "", api_key = None):
 
    payload = {
      "parameters": parameters
    }
    
    parameters = {"parameters": parameters, "model_id": model_id}
    parameters_json =  json.dumps(parameters) 
    
    payload = {'data': parameters_json }

    url = "{}/predict?api_key={}".format(host_name, api_key)
    #-- url = "{}/predict_image_chat?api_key={}".format(host_name, api_key)
    if file_path == "":
         # normal post
         response = requests.post(url, data=payload)   
    else:
        # load file and post 
        file = {'file': open(file_path, 'rb')}
        response = requests.post(url, data=payload, files=file) 
        
    json_data = json.loads(response.content)
      
    return json_data 


# set parameters
parameters = {}

# Set prompt, pass prompt empty on first upload
prompt = "what is the meaning of life?"
parameters["prompt"] = prompt


# optional lang 
# parameters["lang"] = "es"
# please see bottom of documentation for available languages


# optional maximum new tokens setting
#-- parameters["max_new_tokens"] = 512



# replace with your own Chooch api key. Get our Api Key by siging up to Chooch Vision Studio https://app.chooch.ai/
api_key = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx"


file_path = ""

# set model_id
model_id = "chooch-image-chat-3"

return_val = image_chat_predict(model_id, parameters, file_path = file_path, api_key = api_key)


print(return_val)
Code Icon
async function imageChatPredict(modelId, parameters, filePath = "", apiKey = null) {
    const hostName = "https://chat-api.chooch.ai";
    const apiUrl = `${hostName}/predict?api_key=${apiKey || ''}`;

    const formData = new FormData();
    formData.append('parameters', JSON.stringify(parameters));
    formData.append('model_id', modelId);

    let options = {
        method: 'POST',
        body: formData,
    };

    if (filePath !== "") {
        const file = await fetch(filePath).then(response => response.blob());
        formData.append('file', file);
    }

    const response = await fetch(apiUrl, options);
    const jsonData = await response.json();

    return jsonData;
}

// Set parameters
const parameters = {};

// Set prompt, pass prompt empty on the first upload
const prompt = "what is the meaning of life?";
parameters.prompt = prompt;

// Optional lang
// parameters.lang = "es";
// please see bottom of documentation for available languages

// Optional maximum new tokens setting
// parameters.max_new_tokens = 512;

// Replace with your own Chooch API key. Get our API Key by signing up for Chooch Vision Studio https://app.chooch.ai/
const apiKey = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx";

const filePath = ""; // Set your file path if needed

// Set model_id
const modelId = "chooch-image-chat-3";

imageChatPredict(modelId, parameters, filePath, apiKey)
    .then(returnVal => console.log(returnVal))
    .catch(error => console.error(error));
Code Icon
#!/bin/bash

# set parameters
parameters='{"prompt": "what is the meaning of life?"}'

# replace with your own Chooch api key. Get our Api Key by signing up to Chooch Vision Studio https://app.chooch.ai/
api_key="xxxxx-xxxx-xxxx-xxx-xxxxxxxx"

# set model_id
model_id="chooch-image-chat-3"

# change hostname endpoint as needed
host_name="https://chat-api.chooch.ai"

url="${host_name}/predict?api_key=${api_key}"

# cURL command without file upload
curl -X POST -H "Content-Type: application/json" -d "${parameters}" "${url}"

# If file upload is needed, add the following lines:
# file_path="your_file_path_here"
# curl -X POST -H "Content-Type: application/json" -F "file=@${file_path}" -d "${parameters}" "${url}"

Sample Response

3 Circle Icon Code Icon
Code Icon
{
   "prediction":"The question of the meaning of life is a complex and deeply personal one, and there is no one definitive answer that applies to everyone. Different people may have different perspectives on what gives life meaning, and it can be influenced by various factors such as cultural beliefs, personal experiences, and individual values.\n\nHowever, some common themes that people often associate with the meaning of life include:\n\n1. Relationships: Many people find meaning in their relationships with family, friends, and loved ones. Building and maintaining strong connections with others can bring a sense of purpose and fulfillment to life.\n\n2. Personal growth: Some individuals find meaning in their personal growth and development, whether it be through learning new skills, overcoming challenges, or achieving personal goals.\n\n3. Contribution: Many people find meaning in contributing to society, whether through their work, volunteering, or other forms of service. Making a positive impact on the lives of others can provide a sense of purpose and fulfillment.\n\n4. Fulfilling one's potential: Some individuals find meaning in realizing their full potential, whether it be through their career, creative pursuits, or other areas of life.\n\n5. Spirituality or faith: Many people find meaning in their spiritual or religious beliefs, and the connection they feel with a higher power or divine being.\n\n6. Personal values: Some individuals find meaning in living according to their personal values, such as honesty, compassion, or fairness.\n\n7. Legacy: Some people find meaning in leaving a lasting legacy, whether it be through their work, family, or contributions to society.\n\n8. Experiences: Some individuals find meaning in the experiences they have in life, such as traveling, exploring new cultures, or participating in meaningful events.\n\n9. Personal growth through challenges: Some people find meaning in overcoming challenges and personal struggles, as it allows them to grow and develop as individuals.\n\n10. Finding purpose in adversity: Some individuals find meaning in helping others or making a positive impact in the world, even in the face of adversity.\n\nIt is important to note that these themes are not mutually exclusive, and many people may find meaning in multiple aspects of their life. Ultimately, the meaning of life is a deeply personal and subjective concept",
   "prediction_type":"Chooch-ImageChat-3-Text",
   "source_id":"5ad4ab1f-3775-4334-a02e-1e200cabd34e",
   "source_type":"text_chat",
   "model_title":"Chooch-ImageChat-3",
   "model_id":"Chooch-ImageChat-3",
   "status":"Successful Prediction"
}
Predict with source_id, continue chat/conversation on source:
3 Circle Icon
  • Python
  • Javascript (REST)
  • cURL
Code Icon
Code Icon
# predict with source_id, continue chat/conversation on source.

import requests
import json

# change hostname endpoint as needed
host_name = "https://chat-api.chooch.ai"

def image_chat_predict(model_id, parameters, file_path = "", api_key = None):
 
    payload = {
      "parameters": parameters
    }
    
    parameters = {"parameters": parameters, "model_id": model_id}
    parameters_json =  json.dumps(parameters) 
    
    payload = {'data': parameters_json }

    url = "{}/predict?api_key={}".format(host_name, api_key)
    #-- url = "{}/predict_image_chat?api_key={}".format(host_name, api_key)
    if file_path == "":
         # normal post
         response = requests.post(url, data=payload)   
    else:
        # load file and post 
        file = {'file': open(file_path, 'rb')}
        response = requests.post(url, data=payload, files=file) 
        
    json_data = json.loads(response.content)
      
    return json_data 



# set parameters
parameters = {}

# Set prompt, pass prompt empty on first upload
prompt = "ok good but I want to understand more" 
parameters["prompt"] = prompt
parameters["source_id"] = "7745844e-23bb-46fd-84ef-4f8e4aefc0b1"


# optional lang 
# parameters["lang"] = "es"
# please see bottom of documentation for available languages


# optional maximum new tokens setting
#-- parameters["max_new_tokens"] = 512


# replace with your own Chooch api key. Get our Api Key by siging up to Chooch Vision Studio https://app.chooch.ai/
api_key = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx"

file_path = ""


# set model_id
model_id = "chooch-image-chat-3"

return_val = image_chat_predict(model_id, parameters, file_path = file_path, api_key = api_key)


print(return_val)
Code Icon
async function imageChatPredict(modelId, parameters, filePath = "", apiKey = null) {
  const hostName = "https://chat-api.chooch.ai";
  const prompt = "ok good but I want to understand more";
  
  const data = {
    parameters: {
      prompt,
      ...parameters,
      source_id: "7745844e-23bb-46fd-84ef-4f8e4aefc0b1",
    },
    model_id: modelId,
  };

  const url = `${hostName}/predict?api_key=${apiKey || ""}`;
  let response;

  if (filePath === "") {
    // normal post
    response = await fetch(url, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify(data),
    });
  } else {
    // load file and post
    const formData = new FormData();
    formData.append('data', JSON.stringify(data));
    formData.append('file', await fetch(filePath).then(response => response.blob()));

    response = await fetch(url, {
      method: 'POST',
      body: formData,
    });
  }

  const jsonData = await response.json();
  return jsonData;
}

// set parameters
const parameters = {};

// optional lang
// parameters.lang = "es";
// please see bottom of documentation for available languages

// optional maximum new tokens setting
// parameters.max_new_tokens = 512;

// replace with your own Chooch api key. Get our Api Key by signing up to Chooch Vision Studio https://app.chooch.ai/
const apiKey = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx";

const filePath = "";

// set model_id
const modelId = "chooch-image-chat-3";

imageChatPredict(modelId, parameters, filePath, apiKey)
  .then(returnVal => console.log(returnVal))
  .catch(error => console.error(error));
Code Icon
# set parameters
prompt="ok good but I want to understand more"
source_id="7745844e-23bb-46fd-84ef-4f8e4aefc0b1"
api_key="xxxxx-xxxx-xxxx-xxx-xxxxxxxx"
model_id="chooch-image-chat-3"

# optional lang
# lang="es"

# optional maximum new tokens setting
# max_new_tokens=512

# create JSON payload
json_payload='{"parameters": {"prompt": "'"$prompt"'", "source_id": "'"$source_id"'"}'

# add optional parameters to the payload
# if [ -n "$lang" ]; then
#     json_payload+=', "lang": "'"$lang"'"'
# fi
# if [ -n "$max_new_tokens" ]; then
#     json_payload+=', "max_new_tokens": '$max_new_tokens
# fi

# close the JSON payload
json_payload+='}'

# create cURL command
if [ -z "$file_path" ]; then
    # normal post
    curl -X POST -H "Content-Type: application/json" -d "$json_payload" "$host_name/predict?api_key=$api_key"
else
    # load file and post
    curl -X POST -H "Content-Type: application/json" -F "file=@$file_path" -d "$json_payload" "$host_name/predict?api_key=$api_key"
fi

Sample Response

3 Circle Icon Code Icon
Code Icon
{
   "prediction":"I understand, and I'm happy to provide more information on the topic of the meaning of life. However, please keep in mind that this is a complex and philosophical topic that has been debated by scholars, philosophers, and theologians for centuries. There is no one definitive answer to the question of the meaning of life, and different people may have different perspectives on this issue.\n\nThat being said, here are some additional insights and perspectives on the meaning of life:\n\n1. Biological perspective: From a biological perspective, the meaning of life can be seen as the purpose or function that an organism serves within its ecosystem. For example, plants provide oxygen, animals contribute to the food chain, and microorganisms play a crucial role in maintaining the balance of ecosystems.\n\n2. Psychological perspective: From a psychological perspective, the meaning of life can be understood as the sense of purpose and fulfillment that an individual derives from their experiences and relationships. This can involve personal growth, self-actualization, and the pursuit of happiness and well-being.\n\n3. Social perspective: From a social perspective, the meaning of life can be seen as the contributions that an individual makes to their community and society as a whole. This can involve participating in social and civic activities, contributing to the common good, and fostering positive relationships with others.\n\n4. Philosophical perspective: From a philosophical perspective, the meaning of life can be understood as a central question that has been debated by philosophers throughout history. Some philosophers, such as Aristotle, have argued that the meaning of life is to achieve happiness and fulfillment through personal growth and the pursuit of one's potential. Others, such as Friedrich Nietzsche, have argued that the meaning of life is to create one's own values and purpose, rather than relying on external sources.\n\n5. Religious perspective: From a religious perspective, the meaning of life can be understood as the purpose or will of a higher power or divine being. Many religious traditions hold that the meaning of life is to fulfill a divine plan or to follow a set of moral guidelines that align with the teachings of their faith.\n\n6. Existential perspective: From an existential perspective, the meaning of life can be seen as a subjective",
   "prediction_type":"Chooch-ImageChat-3-Text",
   "source_id":"7745844e-23bb-46fd-84ef-4f8e4aefc0b1",
   "source_type":"text_chat",
   "model_title":"Chooch-ImageChat-3",
   "model_id":"Chooch-ImageChat-3",
   "status":"Successful Prediction"
}

Document prediction (prompting)—Beta

Document Prediction enables users to upload text-based files to ImageChat, and it will generate a prediction about the document’s content. This provides detailed insights into the document as well as allows users to create custom prompts to find out more details about the about the document. ImageChat supports the following document formats: .txt, .pdf, .doc, .docx, .ppt, .pptx, .csv, .xls, and .xlsx.

3 Circle Icon
  • Python
  • Javascript (REST)
  • cURL
Code Icon
Code Icon
# ImageChat-3 Predict Document

import requests
import json

# change host name as needed
host_name = "https://chat-api.chooch.ai"

def image_chat_predict(model_id, parameters, file_path = "", api_key = None):
 
    payload = {
      "parameters": parameters
    }
    
    parameters = {"parameters": parameters, "model_id": model_id}
    parameters_json =  json.dumps(parameters) 
    
    payload = {'data': parameters_json }

    url = "{}/predict?api_key={}".format(host_name, api_key)
    #-- url = "{}/predict_image_chat?api_key={}".format(host_name, api_key)
    if file_path == "":
         # normal post
         response = requests.post(url, data=payload)   
    else:
        # load file and post 
        file = {'file': open(file_path, 'rb')}
        response = requests.post(url, data=payload, files=file) 
        
    json_data = json.loads(response.content)
      
    return json_data 


# set parameters
parameters = {}

# Set prompt, pass prompt empty on first upload
prompt = "how was GPT4All trained?"
parameters["prompt"] = prompt

# optional lang 
# parameters["lang"] = "es"
# please see bottom of documentation for available languages

# optional maximum new tokens setting
#-- parameters["max_new_tokens"] = 512

# replace with your own Chooch api key. Get our Api Key by siging up to Chooch Vision Studio https://app.chooch.ai/
api_key = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx"


# make prediction
file_path = "files/2023_GPT4All_Technical_Report.pdf"


# set model_id
model_id = "chooch-image-chat-3"

return_val = image_chat_predict(model_id, parameters, file_path = file_path, api_key = api_key)


print(return_val)
Code Icon
async function imageChatPredict(modelId, parameters, filePath = "", apiKey = null) {
    const hostName = "https://chat-api.chooch.ai";
    
    const payload = {
        parameters: parameters
    };
    
    const parametersJson = JSON.stringify({ parameters: parameters, model_id: modelId });
    
    const formData = new FormData();
    formData.append('data', parametersJson);
    
    const url = `${hostName}/predict?api_key=${apiKey || ''}`;
    
    let response;
    
    if (filePath === "") {
        // Normal post
        response = await fetch(url, {
            method: 'POST',
            body: formData
        });
    } else {
        // Load file and post
        const file = new File([await fetch(filePath).then(res => res.blob())], 'filename');
        formData.append('file', file);
        
        response = await fetch(url, {
            method: 'POST',
            body: formData
        });
    }
    
    const json = await response.json();
    
    return json;
}

// Set parameters
const parameters = {};

// Set prompt, pass prompt empty on first upload
const prompt = "how was GPT4All trained?";
parameters.prompt = prompt;

// Optional lang
// parameters.lang = "es";
// please see bottom of documentation for available languages

// Optional maximum new tokens setting
// parameters.max_new_tokens = 512;

// Replace with your own Chooch API key. Get our API key by signing up to Chooch Vision Studio https://app.chooch.ai/
const apiKey = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx";

// Make prediction
const filePath = "files/2023_GPT4All_Technical_Report.pdf";

// Set model_id
const modelId = "chooch-image-chat-3";

imageChatPredict(modelId, parameters, filePath, apiKey)
    .then(returnVal => {
        console.log(returnVal);
    })
    .catch(error => {
        console.error(error);
    });
Code Icon
#!/bin/bash

# ImageChat-3 Predict Document

host_name="https://chat-api.chooch.ai"
api_key="xxxxx-xxxx-xxxx-xxx-xxxxxxxx"
model_id="chooch-image-chat-3"
file_path="files/2023_GPT4All_Technical_Report.pdf"
prompt="how was GPT4All trained?"

# Set parameters
parameters='{"prompt": "'"$prompt"'"}'

# Set URL
url="$host_name/predict?api_key=$api_key"

# Check if file path is provided
if [ -z "$file_path" ]; then
  # Normal post without file
  curl -X POST -H "Content-Type: application/json" -d "$parameters" "$url"
else
  # Load file and post
  curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache" --form "file=@$file_path" -d "$parameters" "$url"
fi

Sample Response

3 Circle Icon Code Icon
Code Icon
{
   "model_title":"Chooch-ImageChat-3",
   "model_id":"Chooch-ImageChat-3",
   "prediction":"GPT4All was trained using a massive curated corpus of assistant interactions, including word problems, story descriptions, multi-turn dialogue, and code. The training data consisted of roughly one million prompt-response pairs, which were collected and curated to ensure a diverse distribution of prompt topics and model responses. The data was then loaded into Atlas for data curation and cleaning, where any examples where GPT-3.5-Turbo failed to respond to prompts or produced malformed output were removed. The final training dataset consisted of 806,199 high-quality prompt-generation pairs. The model was trained using the collected data, and the training process involved four days of work, $800 in GPU costs, and $500 in OpenAI API spend.",
   "prediction_type":"Chooch-ImageChat-3-Document",
   "prompt":"how was GPT4All trained?",
   "source_id":"ce9ff9bd-cae0-46a1-a966-c1fc3a0512d5.pdf",
   "source_type":"document",
   "status":"Successful Prediction"
}
Predict with source_id, continue chat/conversation on source:
3 Circle Icon
  • Python
  • Javascript (REST)
  • cURL
Code Icon
Code Icon
# predict with source_id, continue chat/conversation on source.

import requests
import json

# change host name as needed
host_name = "https://chat-api.chooch.ai"

def image_chat_predict(model_id, parameters, file_path = "", api_key = None):
 
    payload = {
      "parameters": parameters
    }
    
    parameters = {"parameters": parameters, "model_id": model_id}
    parameters_json =  json.dumps(parameters) 
    
    payload = {'data': parameters_json }

    url = "{}/predict?api_key={}".format(host_name, api_key)
    #-- url = "{}/predict_image_chat?api_key={}".format(host_name, api_key)
    if file_path == "":
         # normal post
         response = requests.post(url, data=payload)   
    else:
        # load file and post 
        file = {'file': open(file_path, 'rb')}
        response = requests.post(url, data=payload, files=file) 
        
    json_data = json.loads(response.content)
      
    return json_data 



# set parameters
parameters = {}

# Set prommpt, pass prompt empty on first upload
prompt = "Who are the authors of GPT4All?" 
parameters["prompt"] = prompt
parameters["source_id"] = 'a0599243-30b6-4714-9806-d14f5b9f0888.pdf'

# optional lang 
# parameters["lang"] = "es"
# please see bottom of documentation for available languages

# optional maximum new tokens setting
#-- parameters["max_new_tokens"] = 512


# replace with your own Chooch api key. Get our Api Key by siging up to Chooch Vision Studio https://app.chooch.ai/
api_key = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx"

file_path = ""


# set model_id
model_id = "chooch-image-chat-3"

return_val = image_chat_predict(model_id, parameters, file_path = file_path, api_key = api_key)


print(return_val)
Code Icon
async function imageChatPredict(modelId, parameters, filePath = "", apiKey = null) {
  const hostName = "https://chat-api.chooch.ai";
  const url = `${hostName}/predict?api_key=${apiKey || ''}`;

  const payload = {
    parameters: parameters,
    model_id: modelId
  };

  const formData = new FormData();
  formData.append('data', JSON.stringify(payload));

  if (filePath !== "") {
    const file = new File([await fetch(filePath).then(response => response.blob())], 'image');
    formData.append('file', file);
  }

  const response = await fetch(url, {
    method: 'POST',
    body: formData
  });

  const jsonData = await response.json();
  return jsonData;
}

// Set parameters
const parameters = {
  prompt: "Who are the authors of GPT4All?",
  source_id: 'a0599243-30b6-4714-9806-d14f5b9f0888.pdf'
  // You can add optional parameters like lang or max_new_tokens here
};

// Replace with your own Chooch API key
const apiKey = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx";

const filePath = "";  // Set the file path if applicable

// Set model_id
const modelId = "chooch-image-chat-3";

// Call the function
imageChatPredict(modelId, parameters, filePath, apiKey)
  .then(returnVal => console.log(returnVal))
  .catch(error => console.error(error));
Code Icon
# Set parameters
prompt="Who are the authors of GPT4All?"
source_id="a0599243-30b6-4714-9806-d14f5b9f0888.pdf"
api_key="xxxxx-xxxx-xxxx-xxx-xxxxxxxx"
model_id="chooch-image-chat-3"

# Set URL
url="https://chat-api.chooch.ai/predict?api_key=$api_key"

# Set data as JSON
data='{"parameters": {"prompt": "'"$prompt"'", "source_id": "'"$source_id"'"}}'

# Check if file path is provided
if [ -z "$file_path" ]; then
    # Normal post without file
    curl -X POST -H "Content-Type: application/json" -d "$data" "$url"
else
    # Load file and post
    curl -X POST -H "Content-Type: application/json" -F "file=@$file_path" -d "$data" "$url"
fi

Sample Response

3 Circle Icon Code Icon
Code Icon
{
   "model_title":"Chooch-ImageChat-3",
   "model_id":"Chooch-ImageChat-3",
   "prediction":"The authors of GPT4All are Yuvanesh Anand, Zach Nussbaum, Brandon Duderstadt, Benjamin Schmidt, and Andriy Mulyar.",
   "prediction_type":"Chooch-ImageChat-3-Document",
   "prompt":"Who are the authors of GPT4All?",
   "source_id":"a0599243-30b6-4714-9806-d14f5b9f0888.pdf",
   "source_type":"document",
   "status":"Successful Prediction"
}
Predict with source_id:
3 Circle Icon
  • Python
  • Javascript (REST)
  • cURL
Code Icon
Code Icon
# predict with source_id

import requests
import json

# change host name as needed
host_name = "https://chat-api.chooch.ai"

def image_chat_predict(model_id, parameters, file_path = "", api_key = None):
 
    payload = {
      "parameters": parameters
    }
    
    parameters = {"parameters": parameters, "model_id": model_id}
    parameters_json =  json.dumps(parameters) 
    
    payload = {'data': parameters_json }

    url = "{}/predict?api_key={}".format(host_name, api_key)
    #-- url = "{}/predict_image_chat?api_key={}".format(host_name, api_key)
    if file_path == "":
         # normal post
         response = requests.post(url, data=payload)   
    else:
        # load file and post 
        file = {'file': open(file_path, 'rb')}
        response = requests.post(url, data=payload, files=file) 
        
    json_data = json.loads(response.content)
      
    return json_data 



# set parameters
parameters = {}

# Set prommpt, pass prompt empty on first upload
prompt = "Summarize This"
parameters["prompt"] = prompt
parameters["source"] = "https://chooch-share.s3.amazonaws.com/2023_GPT4All_Technical_Report.pdf"


# optional lang 
# parameters["lang"] = "es"
# please see bottom of documentation for available languages

# optional maximum new tokens setting
#-- parameters["max_new_tokens"] = 512


# replace with your own Chooch api key. Get our Api Key by siging up to Chooch Vision Studio https://app.chooch.ai/
api_key = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx"

file_path = ""


# set model_id
model_id = "chooch-image-chat-3"

return_val = image_chat_predict(model_id, parameters, file_path = file_path, api_key = api_key)


print(return_val)
Code Icon
async function imageChatPredict(modelId, parameters, filePath = "", apiKey = null) {
    const hostName = "https://chat-api.chooch.ai";
    const url = `${hostName}/predict?api_key=${apiKey || ''}`;
    
    const payload = {
        parameters: parameters,
        model_id: modelId
    };

    const formData = new FormData();
    formData.append('data', JSON.stringify(payload));

    if (filePath !== "") {
        const file = document.querySelector('input[type="file"]').files[0];  // Assuming input type file in HTML
        formData.append('file', file);
    }

    const options = {
        method: 'POST',
        body: formData
    };

    try {
        const response = await fetch(url, options);
        const jsonData = await response.json();
        return jsonData;
    } catch (error) {
        console.error('Error:', error);
    }
}

// Set parameters
const parameters = {
    prompt: "Summarize This",
    source: "https://chooch-share.s3.amazonaws.com/2023_GPT4All_Technical_Report.pdf"
};

// Optional parameters
// parameters.lang = "es";
// parameters.max_new_tokens = 512;

// Replace with your own Chooch API key. Get your API Key by signing up to Chooch Vision Studio https://app.chooch.ai/
const apiKey = "xxxxx-xxxx-xxxx-xxx-xxxxxxxx";

const filePath = "";  // Set the file path if needed

// Set model ID
const modelId = "chooch-image-chat-3";

// Call the function
imageChatPredict(modelId, parameters, filePath, apiKey)
    .then(returnValue => console.log(returnValue))
    .catch(error => console.error('Error:', error));
Code Icon
# Set parameters
prompt="Summarize This"
source="https://chooch-share.s3.amazonaws.com/2023_GPT4All_Technical_Report.pdf"
api_key="xxxxx-xxxx-xxxx-xxx-xxxxxxxx"
model_id="chooch-image-chat-3"

# Prepare payload JSON
parameters='{"prompt": "'"$prompt"'", "source": "'"$source"'"}'
payload='{"data": '$parameters'}'

# Construct cURL command
curl_command="curl -X POST -H 'Content-Type: application/json' -d '$payload' '$host_name/predict?api_key=$api_key'"

# Check if file path is provided
if [ -n "$file_path" ]; then
  # If file path is provided, add file upload to cURL command
  curl_command+=" -F 'file=@$file_path'"
fi

# Execute cURL command
response=$(eval $curl_command)

# Print the response
echo $response

Sample Response

3 Circle Icon Code Icon
Code Icon
{
   "model_title":"Chooch-ImageChat-3",
   "model_id":"Chooch-ImageChat-3",
   "prediction":"The article discusses the creation of a large language model (LLM) dataset by leveraging three publicly available datasets: LAION OIG, Stack Overflow questions, and Big-science/P3. The authors spent significant time on data preparation and curation, removing examples where the model failed to respond or produced malformed output. They also removed the entire Bigscience/P3 sub-set from the final training dataset due to its very high perplexity on a small number of tasks. The authors find that models finetuned on this collected dataset exhibit much lower perplexity in the Self-Instruct evaluation compared to Alpaca. They release the data and training details in the hopes of accelerating open LLM research, particularly in the domains of alignment and interpretability.",
   "prediction_type":"Chooch-ImageChat-3-Document",
   "prompt":"Summarize This",
   "source_id":"8bf1ce62-d5de-4f57-86b9-2340799e0081.pdf",
   "source_type":"document",
   "status":"Successful Prediction"
}

Python libraries supported

ImageChat-3 API calls work best in python when using these libraries:

Python Library Function
requests Facilitates Put Requests to send to ImageChat-3 Server
json Easy usage and manipulation of the returned JSON object
PIL Pillow allows you to easy alter and convert images for best results when sending to ImageChat-3

Supported languages

ImageChat-3 provides support for over 40 languages. You can find the list of supported language codes for the “lang” parameter in the information provided below:

3 Circle Icon Code Icon
Code Icon
ar ("Arabic"), bn ("Bengali"), bg ("Bulgarian"), ca ("Catalan"), zh ("Chinese"), hr ("Croatian"), cs ("Czech"), da ("Danish"), nl ("Dutch"), en ("English"), et ("Estonian"), fi ("Finnish"), fr ("French"), de ("German"), el ("Greek"), gu ("Gujarati"), iw ("Hebrew"), hi ("Hindi"), hu ("Hungarian"), id ("Indonesian"), it ("Italian"), ja ("Japanese"), kn ("Kannada"), ko ("Korean"), lv ("Latvian"), lt ("Lithuanian"), ms ("Malay"), ml ("Malayalam"), mr ("Marathi"), ne ("Nepali"), no ("Norwegian"), fa ("Persian"), pl ("Polish"), pt ("Portuguese"), pa ("Punjabi"), ro ("Romanian"), ru ("Russian"), sr ("Serbian"), sk ("Slovak"), sl ("Slovenian"), es ("Spanish"), sw ("Swahili"), sv ("Swedish"), ta ("Tamil"), te ("Telugu"), th ("Thai"), tr ("Turkish"), uk ("Ukrainian"), ur ("Urdu"), vi ("Vietnamese")

How to access the ImageChat API

To start using  ImageChat, sign up for a free AI Vision Studio account.

Support

If you have any additional questions, please contact [email protected].