Replies: 1 comment 3 replies
-
Just to make it uber-clear, this is the part that's cumbersome, right? # Convert the image to a saveable format
buffer = BytesIO()
plt.savefig(buffer, format="png")
image_data = base64.b64encode(buffer.getvalue())
# Convert the image to Markdown to preview it within Dagster
md_content = f"![img](data:image/png;base64,{image_data.decode()})"
# Attach the Markdown content as metadata to the asset
context.add_output_metadata(metadata={"plot": MetadataValue.md(md_content)}) I agree that this is a lot of code. Would you be up for filing a github issue for making it simpler to include a plot in asset metadata? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I just got started on Dagster working through the introduction tutorial, and noticed that the method of adding a plot to the metadata is really verbose:
Maybe this isn't actually used that often, but are there any efforts, (third-party plugins or future dagster roadmap) to simplify this process?
I would love to see something more similar to streamlit's api for outputting content:
Hoping my input as someone just starting out will more helpful than annoying 🙃
Beta Was this translation helpful? Give feedback.
All reactions