Python client

Deploy a model from Python with the Baseten client.
To deploy a model through the Baseten Python client, first make sure you have it installed. You'll also need an API key.

Deploying a model

Currently scikit-learn, Keras, Hugging Face, LightGBM, XGBoost, and PyTorch models are supported out of the box. That means that you can deploy a model built in one of these frameworks from an in-memory object directly from your Python code:
baseten_model = baseten.deploy(
keras_model, # Model object built with a supported framework
model_name='The best ML model ever',
For specific details, see examples for scikit-learn, Keras, Hugging Face, LightGBM, XGBoost, and PyTorch.
But you don't need to use one of these frameworks to deploy a model on Baseten. You can deploy a model built with any framework, or no framework at all, with a custom model.
model_name='The coolest ML model in existence',
model_class='MyCustomModel', # Class that implements model interface
model_files=['', 'my_model.pkl', 'my_encoder.pkl'],
requirements_file='requirements.txt' # Required packages in pip format
See details on custom models or check out our demos repository for a collection of examples of deploying models on Baseten.

Updating a model

To add a new version of an existing model, simply call baseten.deploy passing it the new model object and the same model_name as the existing model.
Versions auto-increment by minor version, starting at 0.1.0. When updating a model, use the optional argument version_bump='MAJOR' (or 'MINOR' or 'PATCH') to override this default.