Python

The official Python SDK documentation for Banana v1

Deprecation Notice:

Banana V1 infrastructure is sunsetting soon, and users are encouraged to upgrade to V2 when they get the chance. More details to come.

Get your Banana API Key

Sign in on the Banana user dashboard to get your api and model keys

Install Banana

From your terminal, run:

pip3 install banana-dev==4.0.2

Note that 4.0.2 is the final SDK version before v2. Upgrading past 4.0.2 will break this API.

Run

import banana_dev as banana

api_key = "YOUR_API_KEY_HERE"
model_key = "YOUR_MODEL_KEY"
model_inputs = {YOUR_MODEL_INPUT_JSON} # anything you want to send to your model

out = banana.run(api_key, model_key, model_inputs)

Output Json

Calls to banana return a json payload with the following structure

{
    "id": "12345678-1234-1234-1234-123456789012",
    "message": "success",
    "created": 1649712752, 
    "apiVersion": "26 Nov 2021", 
    "modelOutputs": [
        {
            # a json specific to your model. In this example, the caption of the image
            "caption": "a baseball player throwing a ball"
        }
    ]
}

Last updated