Spaces:
Running
Running
tracinginsights
commited on
Commit
·
a62bff6
1
Parent(s):
fcd8f15
Delete multipage.py
Browse files- multipage.py +0 -41
multipage.py
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
"""
|
2 |
-
This file is the framework for generating multiple Streamlit applications
|
3 |
-
through an object oriented framework.
|
4 |
-
"""
|
5 |
-
|
6 |
-
import streamlit as st
|
7 |
-
|
8 |
-
# Define the multipage class to manage the multiple apps in our program
|
9 |
-
class MultiPage:
|
10 |
-
"""Framework for combining multiple streamlit applications."""
|
11 |
-
|
12 |
-
def __init__(self) -> None:
|
13 |
-
"""Constructor class to generate a list which will store all our applications as an instance variable."""
|
14 |
-
self.pages = []
|
15 |
-
|
16 |
-
def add_page(self, title, func) -> None:
|
17 |
-
"""Class Method to Add pages to the project
|
18 |
-
|
19 |
-
Args:
|
20 |
-
title ([str]): The title of page which we are adding to the list of apps
|
21 |
-
|
22 |
-
func: Python function to render this page in Streamlit
|
23 |
-
"""
|
24 |
-
|
25 |
-
self.pages.append(
|
26 |
-
{
|
27 |
-
"title": title,
|
28 |
-
"function": func
|
29 |
-
}
|
30 |
-
)
|
31 |
-
|
32 |
-
def run(self):
|
33 |
-
# Drodown to select the page to run
|
34 |
-
page = st.sidebar.selectbox(
|
35 |
-
'App Navigation',
|
36 |
-
self.pages,
|
37 |
-
format_func=lambda page: page['title']
|
38 |
-
)
|
39 |
-
|
40 |
-
# run the app function
|
41 |
-
page['function']()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|