Links

Integrating

In this page, we'll use the clientside SDKs to call our Potassium server
We'll be using the Python SDK for this example. You may find alternative SDKs here.
Install the Python SDK with pip
pip3 install banana-dev
Create a file called client.py
In client.py, add
import banana_dev as banana
p = {
"prompt": "Hello I am a [MASK] model."
}
api_key = ""
model_key = ""
out = banana.run(api_key, model_key, p)
print(out["modelOutputs"][0])
This code is what will ultimately call your model in prod on Banana's GPUs.
For now, we can leave the api_key and the model_key blank.
Set the BANANA_SERVER environment variable to local to tell the SDK to call your local instance rather than production. Note that this local feature is currently only available to the Python SDK.
export BANANA_SERVER=local
Lastly, we run the client code
python3 client.py
which prints the same as our CURL output from before:
{"outputs":[
{
"score": 0.13177461922168732,
"sequence": "hello i am a fashion model.",
"token": 4827,
"token_str": "fashion"
},
{
"score": 0.1120428815484047,
"sequence": "hello i am a role model.",
"token": 2535,
"token_str": "role"
},
...
{
"score": 0.022045975551009178,
"sequence": "hello i am a model model.",
"token": 2944,
"token_str": "model"}
]}
Awesome! Now it's time to deploy to Banana's serverless GPUs.