Getting Started in a Few Minutes

After this guide you'll have a simple BERT model in prod.
Important: Advanced Customizations
Your app may more complex than this tutorial. If your app:
  • Pipes more than 1Mb data in or out per call
  • Needs more than 5 minutes for inference
  • Runs multiple models
You'll want to refer to the Configuring Potassium documentation.

Setting up a dev environment

Install the Banana CLI with pip.
pip3 install banana-cli
Run the init command to create your "Potassium app"
banana init hello-world
cd hello-world
This downloads boilerplate and installs dependencies.
If you get an error such as "command not found: banana ", you probably haven't added the Python package bin location to your PATH variable. If that's the case, on Mac try something like: export PATH="/Users/<me>/Library/Python/3.9/bin:$PATH"
Your directory will now contain these files:
A freshly created potassium project runs a Huggingface BERT model, for sake of example.

Calling your model locally

Within your hello world potassium project, enter your virtual environment
. ./venv/bin/activate

... and start the dev server!

You should see:
Starting server 🍌
Running init()
Serving on http://localhost:8000
Now open up a different terminal and hit the server with a simple cURL POST request
curl -X POST \
-H "Content-Type: application/json" \
-d '{"prompt": "Software developers start with a Hello, [MASK]! script."}' \
you just ran an inference on a BERT model on your local machine!
"outputs": {
"score": 0.8281897306442261,
"sequence": "software developers start with a hello, world! script.",
"token": 2088,
"token_str": "world"

Using the Banana SDK

cURL request are cool & you can continue to use them but as a convenience layer we'll use this opportunity to demonstrate the use of Banana's SDKs.
We'll be using the Python SDK for this example. You may find alternative SDKs here.
Although OK while testing, you should create a new directory for the following code, not to mix together your app's client and model's server files.
If you're still in the virtual environment from the first step in this guide, deactivate it
Create a new directory
cd ../
mkdir banana-client
cd banana-client
Create a new Python virtual environment in that new directory
python3 -m venv venv
. ./venv/bin/activate
Install the Python SDK with pip
pip3 install banana-dev
The python client must be version 5.0.0 or above
Create a file called with the following code:
from banana_dev import Client
# Create a reference to your model on Banana
my_model = Client(
api_key="YOUR_API_KEY", # Found in dashboard
model_key="YOUR_MODEL_KEY", # Found in model view in dashboard
url="http://localhost:8000", # Pointed to your local instance of potassium
# Specify the model's input JSON
inputs = {
"prompt": "Software developers start with a Hello, [MASK]! script",
# Call your model's inference endpoint on Banana
result, meta ="/", inputs)
This code is what will call your model in a production environment on Banana's GPUs.
For local testing, we set the url to http://localhost:8000 - this will be a different URL for your deployed model.
Lastly, we run the client code
which prints the same as our cURL output from before:
"outputs": {
"score": 0.8281897306442261,
"sequence": "software developers start with a hello, world! script.",
"token": 2088,
"token_str": "world"
Awesome! Now it's time to deploy to Banana's serverless GPUs.

Deploying to Banana

It's time to get off localhost!
You'll need a Github account to deploy, so set one up if you don't already have one.
Pushing to github
Firstly, create a new repo in the Github UI. It may be private or public. Leave it empty.
From within your Potassium App directory, initialize a git project and push to remote
# Add recent changes
git add .
git commit -m "first changes"
# Set upstream to the Github Repo you created
git remote add origin
git branch -M main
# Push
git push -u origin main
Connect your account to banana
Log into Banana and follow the onboarding if you're a new user.
You'll be asked to connect your github, choose the repositories you want Banana to see
Go back to the Banana dashboard and click New Model -> Deploy from Github
Select the model you want to deploy, and you can click into it and watch the build progress
Once built, the model will have "Deployed" status
Call it in prod!
We'll slightly modify our file from before to call our deployed model.
  1. 1.
    Find your api_key on the Home page and add it to your
  2. 2.
    Find your model_key by clicking into the model, and add it to
  3. 3.
    Find your model url by clicking into the model, and add it to as https://<url-slug>
And fire off your first call!
Once the call returns, the replica will remain warm a bit before shutting down.

Now go bananas!!

You've made a production call to a custom BERT model on Banana!
But this is just the beginning.
We encourage you to read Banana Usecases & Configuring Potassium, and explore our app and other docs in the sidebar to see all you can do with Banana!