webinterface.streamlit_utils module#

Streamlit utils.

class webinterface.streamlit_utils.StreamlitLogger(placeholder, logger_name=None, accumulate=True, persist=True)[source]#

Bases: object

Pickup logger and write to Streamlit front end.

Parameters:
  • placeholder (streamlit.empty) – Streamlit placeholder object on which to write logs.

  • logger_name (str, optional) – Module name of logger to pick up. Leave to None to pick up root logger.

  • accumulate (bool, optional) – Whether to accumulate log messages or to overwrite with each new message, keeping only the last line (default: True).

  • persist (bool, optional) – Wheter to keep the log when finished, or empty the placeholder element.

webinterface.streamlit_utils.hide_streamlit_menu()[source]#

Hide Streamlit menu.

webinterface.streamlit_utils.save_dataframe(df)[source]#

Save dataframe to file object, with streamlit cache.

Parameters:

df (pd.DataFrame) – Dataframe to save.

Returns:

The CSV representation of the dataframe encoded in UTF-8.

Return type:

bytes