Examples
Function Creation
import digitalhub as dh
project = dh.get_or_create_project("my_project")
# Create function from project
function = project.new_function(
name="python-function",
kind="python",
code_src="main.py",
handler="function",
python_version="PYTHON3_10"
)
# Or create function from SDK
function = dh.new_function(
project="my-project",
name="python-function",
kind="python",
code_src="main.py",
handler="function",
python_version="PYTHON3_10"
)
Task Execution
Job execution:
Build image:
Serve as service:
Service Invocation
After deploying a service:
Tutorials
Find additional examples in the tutorial repository of the DSLab GitHub organization.
See the Custom ML Model tutorial for comprehensive examples of Python runtime usage.