Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
IBM
GitHub Repository: IBM/watson-machine-learning-samples
Path: blob/master/cpd5.3/notebooks/python_sdk/deployments/custom_library/Use custom software spec to create statsmodels function.ipynb
5081 views
Kernel: watsonx-ai-samples-py-312

Use custom software specification to create statsmodels function describing data with ibm-watsonx-ai

This notebook demonstrates how to deploy in watsonx.ai Runtime service as Python function with statsmodel, which requires creation of custom software specification using requirements.txt file with all required libraries.

Some familiarity with Python is helpful. This notebook uses Python 3.12.

Learning goals

The learning goals of this notebook are:

  • Working with the watsonx.ai instance

  • Creating custom software specification

  • Online deployment of python function

  • Scoring data using deployed function

Contents

This notebook contains the following parts:

  1. Setup

  2. Function creation

  3. Function upload

  4. Web service creation

  5. Scoring

  6. Clean up

  7. Summary and next steps

1. Set up the environment

Before you use the sample code in this notebook, you must perform the following setup tasks:

  • Contact with your IBM Cloud Pak® for Data administrator and ask them for your account credentials

Install dependencies

Note: ibm-watsonx-ai documentation can be found here.

%pip install wget | tail -n 1 %pip install -U ibm-watsonx-ai | tail -n 1 %pip install statsmodels | tail -n 1
Successfully installed wget-3.2 Successfully installed anyio-4.11.0 cachetools-6.2.2 certifi-2025.11.12 charset_normalizer-3.4.4 h11-0.16.0 httpcore-1.0.9 httpx-0.28.1 ibm-cos-sdk-2.14.3 ibm-cos-sdk-core-2.14.3 ibm-cos-sdk-s3transfer-2.14.3 ibm-watsonx-ai-1.4.6 idna-3.11 jmespath-1.0.1 lomond-0.3.3 numpy-2.3.5 pandas-2.2.3 pytz-2025.2 requests-2.32.5 sniffio-1.3.1 tabulate-0.9.0 typing_extensions-4.15.0 tzdata-2025.2 urllib3-2.5.0 Successfully installed patsy-1.0.2 scipy-1.16.3 statsmodels-0.14.5

Define credentials

Authenticate the watsonx.ai Runtime service on IBM Cloud Pak® for Data. You need to provide the admin's username and the platform url.

username = "PASTE YOUR USERNAME HERE" url = "PASTE THE PLATFORM URL HERE"

Use the admin's api_key to authenticate WML services:

import getpass from ibm_watsonx_ai import Credentials credentials = Credentials( username=username, api_key=getpass.getpass("Enter your watsonx.ai API key and hit enter: "), url=url, instance_id="openshift", version="5.3", )

Alternatively you can use the admin's password:

import getpass from ibm_watsonx_ai import Credentials if "credentials" not in locals() or not credentials.api_key: credentials = Credentials( username=username, password=getpass.getpass("Enter your watsonx.ai password and hit enter: "), url=url, instance_id="openshift", version="5.3", )

Create APIClient instance

from ibm_watsonx_ai import APIClient client = APIClient(credentials)

Working with spaces

First of all, you need to create a space that will be used for your work. If you do not have space already created, you can use {PLATFORM_URL}/ml-runtime/spaces?context=icp4data to create one.

  • Click New Deployment Space

  • Create an empty space

  • Go to space Settings tab

  • Copy space_id and paste it below

Tip: You can also use SDK to prepare the space for your work. More information can be found here.

Action: Assign space ID below

space_id = "PASTE YOUR SPACE ID HERE"

You can use list method to print all existing spaces.

client.spaces.list(limit=10)

To be able to interact with all resources available in watsonx.ai, you need to set space which you will be using.

client.set.default_space(space_id)
'SUCCESS'

2. Create function

In this section you will learn how to create deployable function with statsmodels module calculating describition of a given data.

Create deployable callable which uses statsmodels library

def deployable_callable(): """ Deployable python function with score function implemented. """ try: from statsmodels.stats.descriptivestats import describe except ModuleNotFoundError as e: print(f"statsmodels not installed: {str(e)}") raise def score(payload): """ Score method. """ try: data = payload["input_data"][0]["values"] return {"predictions": [{"values": str(describe(data))}]} except Exception as e: return {"predictions": [{"values": [repr(e)]}]} return score

Test callable locally

import numpy as np score_function = deployable_callable() data = np.random.randn(10, 10) data_description = score_function({"input_data": [{"values": data}]}) print(data_description["predictions"][0]["values"])
0 1 2 3 4 \ nobs 10.000000 10.000000 10.000000 10.000000 10.000000 missing 0.000000 0.000000 0.000000 0.000000 0.000000 mean -0.083638 -0.050098 0.020492 -0.142479 -0.002989 std_err 0.269590 0.381256 0.295694 0.313932 0.305275 upper_ci 0.444749 0.697151 0.600042 0.472816 0.595338 lower_ci -0.612025 -0.797346 -0.559058 -0.757775 -0.601316 std 0.852519 1.205638 0.935067 0.992740 0.965363 iqr 0.575500 1.694432 0.951992 1.475172 1.699130 iqr_normal 0.426619 1.256085 0.705713 1.093546 1.259567 mad 0.608134 0.941202 0.692788 0.776608 0.827567 mad_normal 0.762183 1.179622 0.868282 0.973334 1.037201 coef_var -10.192989 -24.065722 45.631417 -6.967606 -322.943959 range 2.564929 3.309147 3.047444 3.203102 2.596324 max 1.667413 1.370861 1.661702 1.484946 1.218249 min -0.897516 -1.938286 -1.385742 -1.718156 -1.378075 skew 1.189520 -0.406203 0.332216 0.057278 -0.287005 kurtosis 3.032307 1.922372 2.333173 2.082519 1.543272 jarque_bera 2.358698 0.758869 0.369220 0.356206 1.021476 jarque_bera_pval 0.307479 0.684248 0.831428 0.836856 0.600052 mode -0.897516 -1.938286 -1.385742 -1.718156 -1.378075 mode_freq 0.100000 0.100000 0.100000 0.100000 0.100000 median -0.263502 0.080095 -0.096555 -0.189843 0.160358 1% -0.881626 -1.929054 -1.348652 -1.664221 -1.363925 5% -0.818066 -1.892126 -1.200291 -1.448478 -1.307328 10% -0.738617 -1.845966 -1.014841 -1.178800 -1.236582 25% -0.675339 -0.757138 -0.491718 -0.877516 -0.891532 50% -0.263502 0.080095 -0.096555 -0.189843 0.160358 75% -0.099839 0.937295 0.460274 0.597656 0.807599 90% 1.249221 1.322948 1.262937 0.922722 0.903711 95% 1.458317 1.346905 1.462319 1.203834 1.060980 99% 1.625594 1.366070 1.621825 1.428723 1.186795 5 6 7 8 9 nobs 10.000000 10.000000 10.000000 10.000000 10.000000 missing 0.000000 0.000000 0.000000 0.000000 0.000000 mean -0.366604 0.155053 -0.260099 0.558822 -0.097734 std_err 0.212456 0.176030 0.430871 0.296286 0.248851 upper_ci 0.049802 0.500064 0.584392 1.139532 0.390004 lower_ci -0.783011 -0.189959 -1.104591 -0.021889 -0.585473 std 0.671845 0.556654 1.362534 0.936940 0.786935 iqr 0.464245 0.981761 1.597027 1.427654 1.142442 iqr_normal 0.344145 0.727781 1.183878 1.058322 0.846893 mad 0.456036 0.476937 1.084414 0.810962 0.650101 mad_normal 0.571557 0.597752 1.359111 1.016390 0.814780 coef_var -1.832616 3.590094 -5.238514 1.676634 -8.051780 range 2.402212 1.590744 4.183076 2.675908 2.230299 max 1.145256 0.904397 1.783463 2.083895 0.834640 min -1.256956 -0.686348 -2.399613 -0.592013 -1.395658 skew 0.946186 -0.105337 -0.089132 0.152338 -0.243300 kurtosis 3.766786 1.558013 2.000850 1.673272 1.785632 jarque_bera 1.737098 0.884879 0.429200 0.772097 0.713113 jarque_bera_pval 0.419560 0.642467 0.806864 0.679738 0.700083 mode -1.256956 -0.686348 -2.399613 -0.592013 -1.395658 mode_freq 0.100000 0.100000 0.100000 0.100000 0.100000 median -0.460046 0.169624 0.008150 0.668493 -0.151084 1% -1.242689 -0.661584 -2.355526 -0.584597 -1.363861 5% -1.185619 -0.562530 -2.179177 -0.554932 -1.236671 10% -1.114282 -0.438712 -1.958742 -0.517851 -1.077683 25% -0.651555 -0.327994 -1.222621 -0.282464 -0.536062 50% -0.460046 0.169624 0.008150 0.668493 -0.151084 75% -0.187310 0.653767 0.374406 1.145190 0.606380 90% 0.231835 0.714157 1.465882 1.576343 0.802512 95% 0.688545 0.809277 1.624673 1.830119 0.818576 99% 1.053914 0.885373 1.751705 2.033140 0.831428

3. Upload Python function

In this section you will learn how to upload the Python function to watsonx.ai.

Custom software_specification

Create new software specification based on runtime-25.1-py3.12.

requirements_txt_content = "statsmodels==0.14.4" with open("requirements.txt", "w") as file: file.write(requirements_txt_content)
base_sw_spec_id = client.software_specifications.get_id_by_name("runtime-25.1-py3.12")

The requirements.txt file describes details of package extension. Now you need to store new package extension using APIClient.

meta_prop_pkg_extn = { client.package_extensions.ConfigurationMetaNames.NAME: "statsmodels env", client.package_extensions.ConfigurationMetaNames.DESCRIPTION: "Environment with statsmodels", client.package_extensions.ConfigurationMetaNames.TYPE: "requirements_txt", } pkg_extn_details = client.package_extensions.store( meta_props=meta_prop_pkg_extn, file_path="requirements.txt" ) pkg_extn_id = client.package_extensions.get_id(pkg_extn_details) pkg_extn_url = client.package_extensions.get_href(pkg_extn_details)
Creating package extension SUCCESS

Create new software specification and add created package extention to it.

meta_prop_sw_spec = { client.software_specifications.ConfigurationMetaNames.NAME: "statsmodels software_spec", client.software_specifications.ConfigurationMetaNames.DESCRIPTION: "Software specification for statsmodels", client.software_specifications.ConfigurationMetaNames.BASE_SOFTWARE_SPECIFICATION: { "guid": base_sw_spec_id }, } sw_spec_details = client.software_specifications.store(meta_props=meta_prop_sw_spec) sw_spec_id = client.software_specifications.get_id(sw_spec_details) client.software_specifications.add_package_extension(sw_spec_id, pkg_extn_id)
SUCCESS
'SUCCESS'

Get the details of created software specification

import json print(json.dumps(client.software_specifications.get_details(sw_spec_id), indent=2))
{ "metadata": { "name": "statsmodels software_spec", "asset_id": "78f46fe3-81f0-4ab9-a4b8-351694cb9652", "href": "/v2/software_specifications/78f46fe3-81f0-4ab9-a4b8-351694cb9652", "asset_type": "software_specification", "created_at": "2025-11-19T07:43:37Z", "life_cycle": { "since_version": "5.2.0" } }, "entity": { "software_specification": { "type": "derived", "display_name": "statsmodels software_spec", "package_extensions": [ { "metadata": { "space_id": "e4509fba-55db-48c5-94a6-08c399762bf2", "usage": { "last_updated_at": "2025-11-19T07:43:31Z", "last_updater_id": "1000331001", "last_update_time": 1763538211266, "last_accessed_at": "2025-11-19T07:43:31Z", "last_access_time": 1763538211266, "last_accessor_id": "1000331001", "access_count": 0 }, "rov": { "mode": 0, "collaborator_ids": {}, "member_roles": { "1000331001": { "user_iam_id": "1000331001", "roles": [ "OWNER" ] } } }, "is_linked_with_sub_container": false, "is_primary_attachment_downloadable": true, "name": "statsmodels env", "description": "Environment with statsmodels", "tags": [ "dsx" ], "asset_type": "package_extension", "origin_country": "us", "rating": 0, "total_ratings": 0, "catalog_id": "4e9e58b2-20cf-4108-91a3-fdafc7a65be7", "created": 1763538209913, "created_at": "2025-11-19T07:43:29Z", "owner_id": "1000331001", "size": 19, "version": 0, "asset_state": "available", "asset_attributes": [ "package_extension" ], "asset_id": "f4dc15e2-f2f1-4cf5-9dc0-ae8b022c8763", "asset_category": "USER", "creator_id": "1000331001", "is_branched": true }, "entity": { "package_extension": { "type": "requirements_txt", "object_key": "package_extension/statsmodels_env_UnwJk1lKT.txt", "interpreter": "pip" } } } ], "base_software_specification": { "guid": "f47ae1c3-198e-5718-b59d-2ea471561e9e", "href": "/v2/software_specifications/f47ae1c3-198e-5718-b59d-2ea471561e9e" }, "software_configuration": { "included_packages": [ { "name": "autoai_libs", "version": "3.0.6", "type": "pip" }, { "name": "autoai_ts_libs", "version": "5.0.5", "type": "pip" }, { "name": "beautifulsoup4", "version": "4.13.3", "type": "pip" }, { "name": "bokeh", "version": "3.7.2", "type": "pip" }, { "name": "caikit", "version": "0.28.1", "type": "pip" }, { "name": "cplex", "version": "22.1.2.0", "type": "pip" }, { "name": "docplex", "version": "2.30.251", "type": "pip" }, { "name": "ffmpeg", "version": "7.1+ibmpyeco", "type": "pip" }, { "name": "ibm-watson-openscale", "version": "3.1.2", "type": "pip" }, { "name": "ibm_watsonx_ai", "version": "1.4.5", "type": "pip" }, { "name": "ipywidgets", "version": "8.1.5", "type": "pip" }, { "name": "keras", "version": "3.12.0", "type": "pip" }, { "name": "lale", "version": "0.9.0", "type": "pip" }, { "name": "lightgbm", "version": "4.5.0+ibmpyeco.1", "type": "pip" }, { "name": "lightning", "version": "2.5.1.post0", "type": "pip" }, { "name": "lightning-utilities", "version": "0.14.3", "type": "pip" }, { "name": "lxml", "version": "5.4.0", "type": "pip" }, { "name": "matplotlib", "version": "3.10.1", "type": "pip" }, { "name": "networkx", "version": "3.4.2", "type": "pip" }, { "name": "numpy", "version": "2.0.2", "type": "pip" }, { "name": "onnx", "version": "1.17.0", "type": "pip" }, { "name": "onnxconverter-common", "version": "1.14.0+ibmpyeco", "type": "pip" }, { "name": "onnxruntime", "version": "1.21.0", "type": "pip" }, { "name": "opencv-python-headless", "version": "4.10.0.84", "type": "pip" }, { "name": "openpyxl", "version": "3.1.5", "type": "pip" }, { "name": "pandas", "version": "2.2.3", "type": "pip" }, { "name": "pillow", "version": "11.1.0", "type": "pip" }, { "name": "plotly", "version": "6.0.1", "type": "pip" }, { "name": "py4j", "version": "0.10.9.9", "type": "pip" }, { "name": "pyarrow", "version": "19.0.0", "type": "pip" }, { "name": "pyjnius", "version": "1.6.1", "type": "pip" }, { "name": "pytorch-lightning", "version": "2.5.0.post0", "type": "pip" }, { "name": "pyviz_comms", "version": "3.0.6", "type": "pip" }, { "name": "scikit-image", "version": "0.25.2", "type": "pip" }, { "name": "scikit-learn", "version": "1.6.1", "type": "pip" }, { "name": "scipy", "version": "1.15.2", "type": "pip" }, { "name": "seaborn", "version": "0.13.2", "type": "pip" }, { "name": "sentencepiece", "version": "0.2.0", "type": "pip" }, { "name": "skl2onnx", "version": "1.18.0", "type": "pip" }, { "name": "snapml", "version": "1.16.2", "type": "pip" }, { "name": "sparkmagic", "version": "0.23.0", "type": "pip" }, { "name": "statsmodels", "version": "0.14.4", "type": "pip" }, { "name": "sympy", "version": "1.13.1", "type": "pip" }, { "name": "tensorflow_cpu", "version": "2.18.1", "type": "pip" }, { "name": "tensorflow-datasets", "version": "4.9.7+ibmpyeco", "type": "pip" }, { "name": "tensorflow-hub", "version": "0.16.1", "type": "pip" }, { "name": "tensorflow-metadata", "version": "1.16.1+ibmpyeco", "type": "pip" }, { "name": "tensorflow-model-optimization", "version": "0.8.0+ibmpyeco", "type": "pip" }, { "name": "tensorflow-probability", "version": "0.25.0", "type": "pip" }, { "name": "tensorflow-text", "version": "2.18.1", "type": "pip" }, { "name": "tf_keras", "version": "2.18.0", "type": "pip" }, { "name": "tf2onnx", "version": "1.16.1+ibmpyeco", "type": "pip" }, { "name": "tokenizers", "version": "0.21.0", "type": "pip" }, { "name": "torch", "version": "2.6.0+ibmpyeco", "type": "pip" }, { "name": "torchdata", "version": "0.9.0+cpu", "type": "pip" }, { "name": "torchmetrics", "version": "1.7.0", "type": "pip" }, { "name": "torchvision", "version": "0.21.0+ibmpyeco", "type": "pip" }, { "name": "transformers", "version": "4.52.4", "type": "pip" }, { "name": "watson-nlp", "version": "5.10.2", "type": "pip" }, { "name": "xgboost-cpu", "version": "2.1.4", "type": "pip" }, { "name": "xlrd", "version": "2.0.1", "type": "pip" } ], "platform": { "name": "python", "version": "3.12", "facilities": [ "pyvenv" ] } } } } }

Store the function

meta_props = { client.repository.FunctionMetaNames.NAME: "statsmodels function", client.repository.FunctionMetaNames.SOFTWARE_SPEC_ID: sw_spec_id, } function_details = client.repository.store_function( meta_props=meta_props, function=deployable_callable ) function_id = client.repository.get_function_id(function_details)

Get function details

print(json.dumps(client.repository.get_details(function_id), indent=2))
{ "metadata": { "name": "statsmodels function", "space_id": "e4509fba-55db-48c5-94a6-08c399762bf2", "resource_key": "907bb544-05d3-4901-8268-4bf3cd92d0b2", "id": "d937e9be-22b7-4e0d-a0f4-d37f3b26b7bb", "created_at": "2025-11-19T07:44:04Z", "rov": { "member_roles": { "1000331001": { "user_iam_id": "1000331001", "roles": [ "OWNER" ] } } }, "owner": "1000331001" }, "entity": { "software_spec": { "id": "78f46fe3-81f0-4ab9-a4b8-351694cb9652" }, "type": "python" } }

Note: You can see that function is successfully stored in watsonx.ai Runtime service.

client.repository.list_functions()

4. Create online deployment

You can use commands bellow to create online deployment for stored function (web service).

Create online deployment of a Python function

metadata = { client.deployments.ConfigurationMetaNames.NAME: "Deployment of statsmodels function", client.deployments.ConfigurationMetaNames.ONLINE: {}, } function_deployment = client.deployments.create(function_id, meta_props=metadata)
###################################################################################### Synchronous deployment creation for id: 'd937e9be-22b7-4e0d-a0f4-d37f3b26b7bb' started ###################################################################################### initializing Note: online_url is deprecated and will be removed in a future release. Use serving_urls instead. ............. ready ----------------------------------------------------------------------------------------------- Successfully finished deployment creation, deployment_id='fd2b8062-fb20-4313-82b0-9f0d60d63bbc' -----------------------------------------------------------------------------------------------
client.deployments.list()

Get deployment id.

deployment_id = client.deployments.get_id(function_deployment) deployment_id
'fd2b8062-fb20-4313-82b0-9f0d60d63bbc'

5. Scoring

You can send new scoring records to web-service deployment using score method.

scoring_payload = {"input_data": [{"values": data}]}
predictions = client.deployments.score(deployment_id, scoring_payload) print(data_description["predictions"][0]["values"])
0 1 2 3 4 \ nobs 10.000000 10.000000 10.000000 10.000000 10.000000 missing 0.000000 0.000000 0.000000 0.000000 0.000000 mean -0.083638 -0.050098 0.020492 -0.142479 -0.002989 std_err 0.269590 0.381256 0.295694 0.313932 0.305275 upper_ci 0.444749 0.697151 0.600042 0.472816 0.595338 lower_ci -0.612025 -0.797346 -0.559058 -0.757775 -0.601316 std 0.852519 1.205638 0.935067 0.992740 0.965363 iqr 0.575500 1.694432 0.951992 1.475172 1.699130 iqr_normal 0.426619 1.256085 0.705713 1.093546 1.259567 mad 0.608134 0.941202 0.692788 0.776608 0.827567 mad_normal 0.762183 1.179622 0.868282 0.973334 1.037201 coef_var -10.192989 -24.065722 45.631417 -6.967606 -322.943959 range 2.564929 3.309147 3.047444 3.203102 2.596324 max 1.667413 1.370861 1.661702 1.484946 1.218249 min -0.897516 -1.938286 -1.385742 -1.718156 -1.378075 skew 1.189520 -0.406203 0.332216 0.057278 -0.287005 kurtosis 3.032307 1.922372 2.333173 2.082519 1.543272 jarque_bera 2.358698 0.758869 0.369220 0.356206 1.021476 jarque_bera_pval 0.307479 0.684248 0.831428 0.836856 0.600052 mode -0.897516 -1.938286 -1.385742 -1.718156 -1.378075 mode_freq 0.100000 0.100000 0.100000 0.100000 0.100000 median -0.263502 0.080095 -0.096555 -0.189843 0.160358 1% -0.881626 -1.929054 -1.348652 -1.664221 -1.363925 5% -0.818066 -1.892126 -1.200291 -1.448478 -1.307328 10% -0.738617 -1.845966 -1.014841 -1.178800 -1.236582 25% -0.675339 -0.757138 -0.491718 -0.877516 -0.891532 50% -0.263502 0.080095 -0.096555 -0.189843 0.160358 75% -0.099839 0.937295 0.460274 0.597656 0.807599 90% 1.249221 1.322948 1.262937 0.922722 0.903711 95% 1.458317 1.346905 1.462319 1.203834 1.060980 99% 1.625594 1.366070 1.621825 1.428723 1.186795 5 6 7 8 9 nobs 10.000000 10.000000 10.000000 10.000000 10.000000 missing 0.000000 0.000000 0.000000 0.000000 0.000000 mean -0.366604 0.155053 -0.260099 0.558822 -0.097734 std_err 0.212456 0.176030 0.430871 0.296286 0.248851 upper_ci 0.049802 0.500064 0.584392 1.139532 0.390004 lower_ci -0.783011 -0.189959 -1.104591 -0.021889 -0.585473 std 0.671845 0.556654 1.362534 0.936940 0.786935 iqr 0.464245 0.981761 1.597027 1.427654 1.142442 iqr_normal 0.344145 0.727781 1.183878 1.058322 0.846893 mad 0.456036 0.476937 1.084414 0.810962 0.650101 mad_normal 0.571557 0.597752 1.359111 1.016390 0.814780 coef_var -1.832616 3.590094 -5.238514 1.676634 -8.051780 range 2.402212 1.590744 4.183076 2.675908 2.230299 max 1.145256 0.904397 1.783463 2.083895 0.834640 min -1.256956 -0.686348 -2.399613 -0.592013 -1.395658 skew 0.946186 -0.105337 -0.089132 0.152338 -0.243300 kurtosis 3.766786 1.558013 2.000850 1.673272 1.785632 jarque_bera 1.737098 0.884879 0.429200 0.772097 0.713113 jarque_bera_pval 0.419560 0.642467 0.806864 0.679738 0.700083 mode -1.256956 -0.686348 -2.399613 -0.592013 -1.395658 mode_freq 0.100000 0.100000 0.100000 0.100000 0.100000 median -0.460046 0.169624 0.008150 0.668493 -0.151084 1% -1.242689 -0.661584 -2.355526 -0.584597 -1.363861 5% -1.185619 -0.562530 -2.179177 -0.554932 -1.236671 10% -1.114282 -0.438712 -1.958742 -0.517851 -1.077683 25% -0.651555 -0.327994 -1.222621 -0.282464 -0.536062 50% -0.460046 0.169624 0.008150 0.668493 -0.151084 75% -0.187310 0.653767 0.374406 1.145190 0.606380 90% 0.231835 0.714157 1.465882 1.576343 0.802512 95% 0.688545 0.809277 1.624673 1.830119 0.818576 99% 1.053914 0.885373 1.751705 2.033140 0.831428

6. Clean up

If you want to clean up all created assets:

  • experiments

  • trainings

  • pipelines

  • model definitions

  • models

  • functions

  • deployments

please follow up this sample notebook.

7. Summary and next steps

You successfully completed this notebook! You learned how to use watsonx.ai for function deployment and scoring with custom software_spec.

Check out our Online Documentation for more samples, tutorials, documentation, how-tos, and blog posts.

Authors

Jan Sołtysik, Software Engineer Intern at watsonx.ai.

Rafał Chrzanowski, Software Engineer Intern at watsonx.ai.

Copyright © 2020-2026 IBM. This notebook and its source code are released under the terms of the MIT License.