HTML
Video Walkthrough

What will you get with this integration?

This integration lets you log any standalone HTML string object or file with Neptune API and have it displayed interactively in the Neptune UI.

Introduction

This guide will show you how to:

Step 0: Before you start

Before you start, make sure that:

Install neptune-client

Depending on your operating system open a terminal or CMD and run this command. All required libraries are available via pip and conda:
pip
conda
1
pip install neptune-client
Copied!
1
conda install -c conda-forge neptune-client
Copied!
For more help see installing neptune-client.
This integration is tested with neptune-client==0.9.19.

Step 1: Import and initialize Neptune

1
import neptune.new as neptune
2
3
run = neptune.init(api_token='<your_api_token>', project='<your_project_name>')
Copied!
You can use the api_token='ANONYMOUS' and project='common/html-support' to explore without having to create a Neptune account
Executing this cell will give you a link looking like: https://app.neptune.ai/common/html-support/e/HTMLSUP-13 with common/html-support replaced by your project, and HTMLSUP-13 replaced by your run.
Click on the link to open the run in Neptune. For now, it is empty but keep the tab with the run open to see what happens next.

Step 2: Log HTML objects to Neptune

Create a sample HTML string and file

1
html_str = "<button type='button', style='background-color:#005879; width:400px; height:400px; font-size:30px'> <a style='color: #ccc', href='https://docs.neptune.ai'> Take me back to the docs!<a> </button>"
2
3
with open('sample.html', 'w') as f:
4
f.write(html_str)
Copied!

Log HTML string object

1
run['html_obj'].upload(neptune.types.File.from_content(html_str, extension='html'))
Copied!

Log HTML file

1
run['html_file'].upload(neptune.types.File('sample.html'))
Copied!

Step 3: Stop logging

Once you are done logging, you should stop tracking the run using the stop() method. This is needed only while logging from a notebook environment. While logging through a script, Neptune automatically stops tracking once the script has completed execution.
1
run.stop()
Copied!

Step 4: Explore the HTML object in Neptune

The object can be found in the All metadata section:

Conclusion

You’ve learned how to:
    Initialize Neptune and create a run,
    Log HTML string objects to Neptune,
    Log HTML files to Neptune.

What's next

Now that you know how to log HTML objects to Neptune, you can learn:
Last modified 1mo ago