-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
63 lines (45 loc) · 1.49 KB
/
app.py
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
52
53
54
55
56
57
58
59
60
61
62
63
import streamlit as st
from app.global_data import init
from app.pages import home, steam, twitter, gtrends
st.set_page_config(layout="wide", initial_sidebar_state="collapsed")
def local_css(path):
with open(path) as f:
s = f.read().replace("\n", " ").rstrip()
st.write(f'<style>{s}</style>', unsafe_allow_html=True)
def local_js(path):
with open(path) as f:
s = f.read().replace("\n", " ").rstrip()
st.write(f'<script>{s}</script>', unsafe_allow_html=True)
def remote_css(url):
st.write(f'<link href="{url}" rel="stylesheet">', unsafe_allow_html=True)
def remote_js(url):
st.write(f'<script src="{url}"></script>', unsafe_allow_html=True)
page_dict = {}
page_names = []
def add_page(title, func):
page_names.append(title)
page_dict[title] = func
def run():
# Drodown to select the page to run
page_name = st.sidebar.selectbox(
'App Navigation',
page_names
)
# run the app function
page_dict[page_name]()
init()
# Title of the main page
# st.title("Covid Forecasting Joint Learning")
# Add all your applications (pages) here
add_page("Home", home.app)
add_page("Steam", steam.app)
add_page("Twitter", twitter.app)
add_page("Google Trends", gtrends.app)
#local_css("assets/css/bootstrap-4-utilities.min.css")
#local_css("assets/css/bootstrap.css")
local_css("assets/css/style.css")
# The main app
run()
#local_js("assets/js/jquery.slim.min.js")
#local_js("assets/js/popper.min.js")
#local_js("assets/js/bootstrap.min.js")