import importlib import re from pathlib import Path import streamlit as st import yaml REGEX_YAML_BLOCK = re.compile(r"---[\n\r]+([\S\s]*?)[\n\r]+---[\n\r](.*)", re.DOTALL) def render_preview(image, title, description): with st.container(): image_col, text_col = st.columns((1, 4)) with image_col: st.image(image) with text_col: st.subheader(title) st.write(description) def render_page(post_path: Path): mod = importlib.import_module(str(post_path)) mod.run_article() def get_page_data(post_path: Path): mod = importlib.import_module(str(post_path)) return { "title": mod.title, "description": mod.description, "date": mod.date, "thumbnail": mod.thumbnail, } def main(): st.set_page_config(layout="wide") posts = { "posts.welcome": "Welcome", "posts.context": "Hate Speech in ACM", "posts.dataset_exploration": "ACM Datasets", "posts.model_exploration": "ACM Models", "posts.conclusion": "Key Takeaways", } page_to_show = list(posts.keys())[0] with st.sidebar: st.markdown( """