Configuration Options
The Pipeline.from_denkflow(file_name, **kwargs)
method is the primary way to load pre-built .denkflow
pipelines. Here are several configuration options for different scenarios:
- Python
- C
from denkflow import Pipeline, HubLicenseSource, OneTimeLicenseSource
# Common parameters (replace with your actual values)
denkflow_file_path = "path/to/your_model.denkflow"
your_pat = "YOUR-PERSONAL-ACCESS-TOKEN"
your_license_id = "YOUR-LICENSE-ID" # Optional
custom_hub_endpoint = "https://your.custom.hub.endpoint" # Optional
# 1. Basic: Using PAT only (Recommended for simplicity)
# Denkflow uses the PAT to handle licensing, typically creating a HubLicenseSource internally.
pipeline_pat_only = Pipeline.from_denkflow(denkflow_file_path, pat=your_pat)
print("Pipeline loaded using PAT only.")
# 2. PAT with a specific License ID
# Useful if your PAT has access to multiple licenses and you need to select one.
pipeline_pat_license_id = Pipeline.from_denkflow(
denkflow_file_path,
pat=your_pat,
license_id=your_license_id
)
print(f"Pipeline loaded using PAT and License ID: {your_license_id}")
# 3. PAT with a custom Hub endpoint
# For testing instances of the DENKweit Vision AI Hub.
pipeline_pat_custom_endpoint = Pipeline.from_denkflow(
denkflow_file_path,
pat=your_pat,
endpoint=custom_hub_endpoint
)
print(f"Pipeline loaded using PAT and custom endpoint: {custom_hub_endpoint}")
# 4. Using a pre-configured HubLicenseSource
# Provides more control over license source creation.
hub_license_source = HubLicenseSource.from_pat(pat=your_pat, license_id=your_license_id)
pipeline_hub_ls = Pipeline.from_denkflow(
denkflow_file_path,
license_source=hub_license_source
)
print("Pipeline loaded using a pre-configured HubLicenseSource.")
# 5. Using a pre-configured OneTimeLicenseSource
initial_hub_src = HubLicenseSource.from_pat(pat=your_pat, license_id=your_license_id)
one_time_license_source = initial_hub_src.to_one_time_license_source()
pipeline_one_time_ls = Pipeline.from_denkflow(
denkflow_file_path,
license_source=one_time_license_source
)
print("Pipeline loaded using a pre-configured OneTimeLicenseSource.")
# 6. PAT with `one_time_registration=True` (Enables offline use after first run)
pipeline_one_time_reg = Pipeline.from_denkflow(
denkflow_file_path,
pat=your_pat,
one_time_registration=True
)
print("Pipeline loaded using PAT with one_time_registration=True.")
Parameter Reference
The Pipeline.from_denkflow
method accepts the following key parameters:
file_name: str
(Required): The path to your.denkflow
model file.pat: Optional[str] = None
: Your Personal Access Token from the Vision AI Hub.license_source: Optional[HubLicenseSource | OneTimeLicenseSource] = None
: A pre-configured license source object.license_id: Optional[str] = None
: Whenpat
is used for licensing, this optionally specifies alicense_id
.endpoint: Optional[str] = None
: Custom URL for the Vision AI Hub endpoint.one_time_registration: bool = False
: WhenTrue
, enables offline use after the first successful run.
There are different options when creating a HubLicenseSource:
// Create a HubLicensSource using only a PAT
HubLicenseSource* hub_license_source = nullptr;
std::string pat = "personal_access_token";
const char NULL_BYTE [1] = {'\0'};
hub_license_source_from_pat(&hub_license_source, pat.c_str(), NULL_BYTE, NULL_BYTE);
// Create a HubLicensSource using a PAT and a custom license ID
HubLicenseSource* hub_license_source = nullptr;
std::string pat = "personal_access_token";
std::string license_id = "license_id";
const char NULL_BYTE [1] = {'\0'};
hub_license_source_from_pat(&hub_license_source, pat.c_str(), license_id, NULL_BYTE);
// Create a HubLicensSource using a PAT and a custom endpoint
HubLicenseSource* hub_license_source = nullptr;
std::string pat = "personal_access_token";
std::string endpoint = "alternative_endpoint";
const char NULL_BYTE [1] = {'\0'};
hub_license_source_from_pat(&hub_license_source, pat.c_str(), NULL_BYTE, endpoint);
// Create a OneTimeLicenseSource from a HubLicensSource
HubLicenseSource* hub_license_source = nullptr;
OneTimeLicenseSource* one_time_license_source = nullptr;
std::string pat = "personal_access_token";
std::string endpoint = "alternative_endpoint";
const char NULL_BYTE [1] = {'\0'};
hub_license_source_to_one_time_license_source(&one_time_license_source, &hub_license_source);
After creating the license source, the pipeline can be created via:
Pipeline* pipeline = nullptr;
std::string model_file = "path/to/model/file.denkflow";
pipeline_from_denkflow(&pipeline, model_file.c_str(), (void**)&license_source);
Important Notes:
- For any licensing method involving offline persistence, ensure the
DENKFLOW_DATA_DIRECTORY
environment variable is correctly set to a persistent location. - If both
pat
andlicense_source
are provided, thelicense_source
takes precedence.