Skip to main content
Version: 25.4

snorkelflow.client.applications.add_block_to_application

snorkelflow.client.applications.add_block_to_application(application, template_id, input_node, block_config, from_block_uid=None, label_schema_uid=None)

Add a block to an existing application.

Parameters

NameTypeDefaultInfo
applicationUnion[str, int]The name or UID of the new application.
template_idstrThe string identifier for the type of block.
input_nodeintThe UID of the input node.
block_configDict[str, Any]

A dictionary representation of the configuration for the block, with below key-value pairs defined:

  • ”extraction_field”: str # For information extraction tasks only, in which case str value should be name of column from which to perform extraction

  • ”hocr_field”: str # For hOCR Extraction tasks only, in which case str value should be {name of hOCR data column}

  • ”label_col”: str # For single-label classification tasks only, in which case str should be name of column with GT labels

  • ”label_map”: Dict[str, int]

  • ”pdf_field”: str # For PDF classification tasks and native PDF extraction tasks only, in which case str value should be name of column containing rich doc pdf url’s”

  • ”seq_field”: str # For sequence-tagging tasks only, in which case str value should be name of column on which to perform sequence tagging.

from_block_uidOptional[int]NoneAn optional identifier for a block to copy from.
label_schema_uidOptional[int]NoneAn optional identifier for a label schema to use.

Returns

Information on the created block

Return type

Dict[str, Any]

Examples

>>> sf.add_block_to_application(
>>> application=APP_NAME,
>>> template_id="clf",
>>> input_node=INPUT_NODE_ID,
>>> block_config=dict(
>>> label_map=dict(UNKNOWN=-1, NEGATIVE=0, POSITIVE=1),
>>> ),
>>> )
{'block_uid': <block_uid>, 'node_uids': [node_uid,...], 'job_ids': [job_id,...]}