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.
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:
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.
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.
Parent topic: Managing an inventory of model assets