Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to capture & display plot images in Hamilton UI #1117

Open
skrawcz opened this issue Sep 3, 2024 · 1 comment
Open

Add ability to capture & display plot images in Hamilton UI #1117

skrawcz opened this issue Sep 3, 2024 · 1 comment
Labels
SDK Related to hamilton SDK for th UI UI Related to the Hamilton UI visualization

Comments

@skrawcz
Copy link
Collaborator

skrawcz commented Sep 3, 2024

Is your feature request related to a problem? Please describe.
Motivation:

  • I am outputting plots & I want to see them in the Hamilton UI
  • e.g. I'm coming from the experiment tracker, but want to use the Hamilton UI

Describe the solution you'd like

  1. I use a plotly or matplotlib materializers.
  2. The hamilton tracker should capture the plot and enable viewing in the UI.

Describe alternatives you've considered
N/A

Additional context

The task here is two fold:

  1. Add to the Hamilton adapter some tracking to check for the materializer and then encode the plots in base64 (I think that's the best approach).
  2. The UI needs a new component, and then the ability to take that encoded image and display it in the UI.
@skrawcz skrawcz added visualization UI Related to the Hamilton UI SDK Related to hamilton SDK for th UI labels Sep 3, 2024
@zilto
Copy link
Collaborator

zilto commented Sep 17, 2024

One straightforward solution could be to use IPython. Via from IPython.core.display import HTML you can use HTML(obj) and get an HTML representation of any Python object.

We could use that for any Python object and serialize the HTML string. Then, the UI can deserialize the HTML and display it in an iframe.

Limitations:

  • outputing PNG and other bitmap would lead to large bytestrings.
  • need to use iframe to prevent exploits when deserializing HTML

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SDK Related to hamilton SDK for th UI UI Related to the Hamilton UI visualization
Projects
None yet
Development

No branches or pull requests

2 participants