How to view png images from pm4py Process Mining

How to view images generated from the pm4py package

import pm4py
import os

log = pm4py.read_xes(os.path.join("tests", "input_data", "receipt.xes"))
pm4py.view_events_distribution_graph(log, distr_type="days_week", format="svg")

using

st.write(pm4py.view_events_distribution_graph(log, distr_type="days_week", format="svg"))

returning None

You should save the export to an image and then use st.image:

from pm4py.algo.discovery.dfg import algorithm as dfg_discovery
log = xes_importer.apply(‘receipt.xes’)
dfg = dfg_discovery.apply(log)
gviz = dfg_visualization.apply(dfg, log=log, variant=dfg_visualization.Variants.FREQUENCY)

from PIL import Image
image = Image.open(dfg_visualization.view(gviz))
st.image(image, caption=‘Frequency chart’)

https://docs.streamlit.io/en/stable/api.html#display-media