Links

Models

Use the baseten.models module to call models.
The baseten.models module lets you use a Python interface to interact with state of the art machine learning models hosted on Baseten. The Python interfaces are more expressive than a generic API and lets you use these models from your local computer.
Specifically, this module lets you:
  • Interact with Stable Diffusion, Whisper and Flan-T5
  • Sign up for Baseten
  • Upload files to S3

Getting started

Open up your Python environment or Jupyter notebook, then follow three steps to be ready to develop:
  1. 1.
    Run pip install --upgrade baseten to get the latest version of the Baseten package.
  2. 2.
    Make sure you have a Baseten account, or create one in your command line with baseten signup.
  3. 3.
    Generate an API key in your Baseten account and copy it somewhere safe.
Now you're ready to develop!

Calling models

Please refer to the individual model docs for more advanced usage of models. At a high level, you can interact with models like this:

Stable Diffusion

from baseten.models import StableDiffusionPipeline
sd = StableDiffusionPipeline()
img, safe = sd("dog running on grass")
# To see the image
img[0].save("my-image.png")

Whisper

from baseten.models import Whisper
whisper = Whisper()
transcribed = whisper("https://cdn.baseten.co/docs/production/Gettysburg.mp3")

Flan-T5

from baseten.models import FlanT5
flan = FlanT5()
generated = flan("Could Albert Einstein have attended the super bowl?")