0 / 0
Attaching files to a factsheet using the Python client

Attaching files to a factsheet using the Python client

Add file attachments to a factsheet to provide supplemental detail. For example, attach model visualizations or a requirements document to support the use case.

You can attach images or files that support your use case to a factsheet by using the AIGovFacts python client utility.

If you want to define attachment definitions and attachment groups so that users can attach files to a factsheet by using the model inventory, see Administering AI Factsheets.

The code for attaching a file or image looks as follows:

model=facts_client.assets.get_model(model_id='94566964-de43-4cdf-8af4-10ad12e268db')
model.set_attachment_fact(file_to_upload="./artifacts/roc_curve.jpeg",description="Roc curve for the model",fact_id="roc_curve_001",html_rendering_hint="inline_image")

Once attached, the images display as follows:

File attachments for a factsheet

When the facts are added to a model, you can view them in the model details page in the Other Attachments section. From that section, you can preview, download and delete the file attachment or image facts.

Viewing attachments

How you view an attachment depends on the file type.

  • If the fact is of type image, then it shows up as inline image and users can preview, download, or delete the attachment.
  • If the fact is of type document, there is no inline image. Users can preview, download, or delete the file.
  • Attachments are included with reports generated from factsheets.

Learn more

Parent topic: Managing an inventory of model assets

Generative AI search and answer
These answers are generated by a large language model in watsonx.ai based on content from the product documentation. Learn more