Use the baseten.models module to call models.
baseten.modelsmodule 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
Open up your Python environment or Jupyter notebook, then follow three steps to be ready to develop:
pip install --upgrade basetento get the latest version of the Baseten package.
- 2.Make sure you have a Baseten account, or create one in your command line with
Now you're ready to develop!
Please refer to the individual model docs for more advanced usage of models. At a high level, you can interact with models like this:
from baseten.models import StableDiffusionPipeline
sd = StableDiffusionPipeline()
img, safe = sd("dog running on grass")
# To see the image
from baseten.models import Whisper
whisper = Whisper()
transcribed = whisper("https://cdn.baseten.co/docs/production/Gettysburg.mp3")
from baseten.models import FlanT5
flan = FlanT5()
generated = flan("Could Albert Einstein have attended the super bowl?")