Skip to content

Log HTML

Comet's HTML logging lets you log any HTML blob which is then rendered as an iframe in the Comet UI.

Example HTML tab
Example of HTML rendered in the Comet UI

With Comet you can log one or more HTML samples. In the latter case, the HTML samples are rendered one after another.

The following method can be used to log html:

In addition all the html snippets logged to an Experiment can be view in the Single Experiment page tabs:

For example, you could...

Log SHAP (SHapley Additive exPlanations) values to display and interactively analyze how each feature affects the model's predictions for specific instances.

Log an HTML tag

The example below logs a single HTML tag.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import comet_ml

# Initialize the Comet Experiment
comet_ml.init()
exp = comet_ml.Experiment()

# Create an example HTML sample
html = '<a href="www.comet.com"> I love Comet</a>'

# Log the HTML sample to Comet
exp.log_html(html)

If you call log_html() more than once, the HTML will be concatenated. You can also override previous HTML data, e.g. with a more recent sample, using the clear argument.

May. 17, 2024