webinterface.streamlit_utils module#
Streamlit utils.
- class webinterface.streamlit_utils.StreamlitLogger(placeholder, logger_name=None, accumulate=True, persist=True)[source]#
Bases:
objectPickup 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.display_error(friendly_message: str, exception: Exception = None, suggestions: list = None, technical_details: str = None)[source]#
Display user-friendly error with expandable technical details.
- Parameters:
friendly_message (str) – A user-friendly error message to display prominently.
exception (Exception, optional) – The exception object to show with Streamlit’s nice traceback formatting.
suggestions (list, optional) – List of suggestions to help the user resolve the error.
technical_details (str, optional) – Technical error details as string (used if exception is not provided).
- webinterface.streamlit_utils.get_error_suggestions(exception: Exception, context: dict) tuple[source]#
Analyze exception and return user-friendly message with suggestions.
Hide Streamlit menu.