alfraser commited on
Commit
d934e05
·
1 Parent(s): b01f66a

Set up security with secrets on the hugging face side and helper function across pages which manages the security and logo.

Browse files
LLM_Architectures.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from src.st_helpers import st_setup
3
+
4
+ if st_setup("LLM Architectures"):
5
+ st.write("# Testing testing 123")
README.md CHANGED
@@ -5,7 +5,7 @@ colorFrom: green
5
  colorTo: indigo
6
  sdk: streamlit
7
  sdk_version: 1.28.2
8
- app_file: app.py
9
  pinned: false
10
  license: cc-by-sa-4.0
11
  ---
 
5
  colorTo: indigo
6
  sdk: streamlit
7
  sdk_version: 1.28.2
8
+ app_file: LLM_Architectures.py
9
  pinned: false
10
  license: cc-by-sa-4.0
11
  ---
app.py DELETED
@@ -1,3 +0,0 @@
1
- import streamlit as st
2
-
3
- st.write("# Testing testing 123")
 
 
 
 
img/uob-logo.png ADDED
pages/010_LLM_Arch.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from src.st_helpers import st_setup
3
+
4
+ if st_setup('LLM Arch'):
5
+ st.write("Sample text")
src/st_helpers.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ def st_setup(page_title: str, layout: str = 'wide'):
4
+ """
5
+ Sets up standard outline (wide layout), checks for logged in status and then
6
+ displays the login box if not logged in. Should be used as a conditional to display
7
+ the other content on the page.
8
+ :param page_title: The streamlit page title for this page
9
+ :return: bool - logged in status
10
+ """
11
+ st.set_page_config(page_title=page_title, layout=layout)
12
+ with st.sidebar:
13
+ st.image('img/uob-logo.png', width=200)
14
+
15
+ logged_in='logged_in'
16
+ if logged_in not in st.session_state or st.session_state[logged_in]==False:
17
+ _, c2, _ = st.columns(3)
18
+ with c2:
19
+ st.write('### Log in')
20
+ pw = st.text_input(type='password', label='Password')
21
+ if st.button('Log in'):
22
+ if pw == st.secrets['app_password']:
23
+ st.session_state[logged_in]=True
24
+ st.rerun()
25
+ else:
26
+ st.info("Invalid password")
27
+ return False
28
+ else:
29
+ return True