File size: 711 Bytes
14b4bdd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
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'<style>{f.read()}</style>', unsafe_allow_html=True)
def remote_css(css_url):
st.markdown(f'<link href="{css_url}" rel="stylesheet">', unsafe_allow_html=True)
|