Spaces:
Running
Running
File size: 1,264 Bytes
83537e0 |
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
import streamlit as st
from PIL import Image
import tempfile
import logging
logger = logging.getLogger(__name__)
# Initialization
if 'file' not in st.session_state:
st.session_state['pipeline'] = None
class MultiApp:
"""
Framework for combining multiple streamlit applications.
"""
def __init__(self):
self.apps = []
#if 'file' not in st.session_state:
# st.session_state['file'] = None
def add_app(self, title, func):
"""Adds a new application.
Parameters
----------
func:
the python function to render this app.
title:
title of the app. Appears in the dropdown in the sidebar.
"""
self.apps.append({
"title": title,
# "icon": icon,
"function": func
})
def run(self):
st.sidebar.write(format_func=lambda app: app['title'])
#image = Image.open('appStore/img/sdsn.png')
#st.sidebar.image(image)
st.sidebar.markdown("## 📌 Pages ")
app = st.sidebar.radio(
'Pages',
self.apps,
format_func=lambda app: app['title'])
app['function']()
st.sidebar.markdown('')
|