import streamlit as st import json from PIL import Image def load_image(image_path, image_resize=None): image = Image.open(image_path) if isinstance(image_resize, tuple): image.resize(image_resize) return image def load_text(text_path): text = '' with open(text_path) as f: text = f.read() return text def load_json(json_path): jdata = '' with open(json_path) as f: jdata = json.load(f) return jdata def local_css(css_path): with open(css_path) as f: st.markdown(f'', unsafe_allow_html=True) def remote_css(css_url): st.markdown(f'', unsafe_allow_html=True) def pure_comma_separation(list_str, return_list=True): r = [item.strip() for item in list_str.split(",")] # r = list(set([x.strip() for x in list_str.strip().split(',') if len(x.strip()) > 0])) if return_list: return r return ", ".join(r)